From a54ffe6931f1cbf070746eb2e3575c4d77b71256 Mon Sep 17 00:00:00 2001 From: Jackson <56949000+jacksonchen1998@users.noreply.github.com> Date: Mon, 10 Jul 2023 01:20:01 +0800 Subject: [PATCH 01/26] [UPDATE] translate `venv.po` (#463) * [UPDATE] translate `library/venv.po` * [DEL] * [UPDATE] * [UPDATE] translate Creating virtual environments * Update library/venv.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/venv.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/venv.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/venv.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/venv.po Co-authored-by: Wei-Hsiang (Matt) Wang * [UDAPTE] Some typo in`venv.po` --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/venv.po | 62 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/library/venv.po b/library/venv.po index afe3f38074..edabd97b3b 100644 --- a/library/venv.po +++ b/library/venv.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" -"PO-Revision-Date: 2018-05-23 16:15+0000\n" -"Last-Translator: Adrian Liaw \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-" "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.3.2\n" #: ../../library/venv.rst:2 msgid ":mod:`venv` --- Creation of virtual environments" @@ -28,13 +29,13 @@ msgstr "**原始碼:**\\ :source:`Lib/venv/`" #: ../../library/venv.rst:21 msgid "" -"The :mod:`!venv` module supports creating lightweight \"virtual " -"environments\", each with their own independent set of Python packages " -"installed in their :mod:`site` directories. A virtual environment is created " -"on top of an existing Python installation, known as the virtual " -"environment's \"base\" Python, and may optionally be isolated from the " -"packages in the base environment, so only those explicitly installed in the " -"virtual environment are available." +"The :mod:`!venv` module supports creating lightweight \"virtual environments" +"\", each with their own independent set of Python packages installed in " +"their :mod:`site` directories. A virtual environment is created on top of an " +"existing Python installation, known as the virtual environment's \"base\" " +"Python, and may optionally be isolated from the packages in the base " +"environment, so only those explicitly installed in the virtual environment " +"are available." msgstr "" #: ../../library/venv.rst:29 @@ -68,13 +69,13 @@ msgstr "" #: ../../library/venv.rst:43 msgid "Creating virtual environments" -msgstr "" +msgstr "建立虛擬環境" #: ../../using/venv-create.inc:1 msgid "" "Creation of :ref:`virtual environments ` is done by executing the " "command ``venv``::" -msgstr "" +msgstr "建立\\ :ref:`虛擬環境 `\\ 的方法是透過執行指令 ``venv``:" #: ../../using/venv-create.inc:6 msgid "" @@ -89,49 +90,63 @@ msgid "" "this is ``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``)。如果指定的目錄已存在,則將重新使用該目錄。" #: ../../using/venv-create.inc:17 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 `." msgstr "" +"``pyvenv`` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 Python 3.6 " +"中已被\\ :ref:`棄用 `。" #: ../../using/venv-create.inc:22 msgid "" "The use of ``venv`` is now recommended for creating virtual environments." -msgstr "" +msgstr "目前建議使用 ``venv`` 來建立虛擬環境。" #: ../../using/venv-create.inc:27 msgid "On Windows, invoke the ``venv`` command as follows::" -msgstr "" +msgstr "在 Windows 上,執行以下命令以使用 ``venv``:" #: ../../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:36 msgid "The command, if run with ``-h``, will show the available options::" -msgstr "" +msgstr "如果使用 ``-h`` 選項執行該命令,將會顯示可用的選項:" #: ../../using/venv-create.inc:70 msgid "" "Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " "PyPI" msgstr "" +"新增 ``--upgrade-deps`` 選項以將 pip 和 setuptools 升級至 PyPI 上的最新版本" #: ../../using/venv-create.inc:73 msgid "" "Installs pip by default, added the ``--without-pip`` and ``--copies`` " "options" -msgstr "" +msgstr "預設情況下安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" #: ../../using/venv-create.inc:77 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:82 msgid "" @@ -139,6 +154,8 @@ msgid "" "particular note is that double-clicking ``python.exe`` in File Explorer will " "resolve the symlink eagerly and ignore the virtual environment." msgstr "" +"雖然在 Windows 上支援符號連結,但並不建議使用。特別需要注意的是,在檔案總管中" +"按兩下 ``python.exe`` 會急切地解析符號連結並忽略虛擬環境。" #: ../../using/venv-create.inc:87 msgid "" @@ -146,6 +163,8 @@ msgid "" "script by setting the execution policy for the user. You can do this by " "issuing the following PowerShell command:" msgstr "" +"在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 ``Activate." +"ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" #: ../../using/venv-create.inc:91 msgid "" @@ -157,6 +176,8 @@ msgid "" "See `About Execution Policies `_ for more information." msgstr "" +"有關更多資訊,請參閱\\ `關於執行策略 `_。" #: ../../using/venv-create.inc:97 msgid "" @@ -164,12 +185,17 @@ msgid "" "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`` 選項,則設置為 " +"``true``,否則設置為 ``false``。" #: ../../using/venv-create.inc:101 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` 來啟動 " +"``pip`` 到虛擬環境中。" #: ../../using/venv-create.inc:104 msgid "" @@ -177,6 +203,8 @@ msgid "" "environment will be created, according to the given options, at each " "provided path." msgstr "" +"可以向 ``venv`` 提供多個路徑,這樣每個提供的路徑都將根據給定的選項建立一個相" +"同的虛擬環境。" #: ../../library/venv.rst:50 msgid "How venvs work" @@ -576,8 +604,8 @@ msgstr "" #: ../../library/venv.rst:315 msgid "" -"*path* is the path to a directory that should contain subdirectories " -"\"common\", \"posix\", \"nt\", each containing scripts destined for the bin " +"*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:" From 3553fa2ad2820e2cd518d06f875bd87e44edc1ad Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Mon, 10 Jul 2023 12:32:42 +0800 Subject: [PATCH 02/26] Adds more translations of `library/statistics.po` (#448) * Adds more translations of * Small fixes of library/statistics.po * Small fixes * add more translations of statistics.quantiles * fixes build failure --- library/statistics.po | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/library/statistics.po b/library/statistics.po index c8d18c1461..9a704d35bf 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-03 00:17+0000\n" -"PO-Revision-Date: 2023-07-07 00:32+0800\n" +"PO-Revision-Date: 2023-07-09 21:14+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -579,6 +579,8 @@ msgid "" "\"Statistics for the Behavioral Sciences\", Frederick J Gravetter and Larry " "B Wallnau (8th Edition)." msgstr "" +"\"Statistics for the Behavioral Sciences\", Frederick J Gravetter and Larry " +"B Wallnau (8th Edition)." #: ../../library/statistics.rst:376 msgid "" @@ -587,6 +589,9 @@ msgid "" "spreadsheet, including `this discussion `_." msgstr "" +"Gnome Gnumeric 試算表中的 `SSMEDIAN `_ 函式,包括\\ `這篇討論 " +"`_。" #: ../../library/statistics.rst:384 msgid "" @@ -791,6 +796,9 @@ msgid "" "representative (e.g. independent and identically distributed), the result " "should be an unbiased estimate of the true population variance." msgstr "" +"這是經過 Bessel 校正 (Bessel's correction) 後的樣本變異數 s² ,又稱為自由度" +"為 N-1 的變異數。只要資料點具有代表性(例如:獨立且具有相同分布),結果應該會" +"是對真實母體變異數的不偏估計。" #: ../../library/statistics.rst:571 msgid "" @@ -798,12 +806,16 @@ msgid "" "func:`pvariance` function as the *mu* parameter to get the variance of a " "sample." msgstr "" +"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳入 :func:" +"`pvariance` 函式來計算樣本變異數。" #: ../../library/statistics.rst:577 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." msgstr "" +"將 *data* 分成 *n* 個具有相等機率的連續區間。回傳一個包含 ``n - 1`` 個用於切" +"分各區間的分隔點的 list。" #: ../../library/statistics.rst:580 msgid "" @@ -812,6 +824,9 @@ msgid "" "*data* into 100 equal sized groups. Raises :exc:`StatisticsError` if *n* is " "not least 1." msgstr "" +"將 *n* 設為 4 以表示四分位數 (quartile) (預設值)。將 *n* 設置為 100 表示百" +"分位數 (percentile),這將給出 99 個分隔點將 *data* 分成 100 個大小相等的組。" +"如果 *n* 不是至少為 1,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:585 msgid "" @@ -819,6 +834,8 @@ msgid "" "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." msgstr "" +"*data* 可以是包含樣本資料的任何 iterable。為了取得有意義的結果,*data* 中的資" +"料點數量應大於 *n*。如果資料點少於兩個,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:589 msgid "" @@ -826,6 +843,8 @@ msgid "" "For example, if a cut point falls one-third of the distance between two " "sample values, ``100`` and ``112``, the cut-point will evaluate to ``104``." msgstr "" +"分隔點是從兩個最近的資料點線性內插值計算出來的。舉例來說,如果分隔點落在兩個" +"樣本值 ``100`` 與 ``112`` 之間的距離三分之一處,則分隔點的值將為 ``104``。" #: ../../library/statistics.rst:594 msgid "" @@ -833,6 +852,8 @@ msgid "" "*data* includes or excludes the lowest and highest possible values from the " "population." msgstr "" +"計算分位數的 *method* 可以根據 *data* 是否包含或排除來自母體的最小與最大可能" +"的值而改變。" #: ../../library/statistics.rst:598 msgid "" @@ -843,6 +864,10 @@ msgid "" "them and assigns the following percentiles: 10%, 20%, 30%, 40%, 50%, 60%, " "70%, 80%, 90%." msgstr "" +"預設的 *method* 是 \"exclusive\",用於從可能找到比樣本更極端的值的母體中抽樣的" +"樣本資料。對於 *m* 個已排序的資料點,計算出低於 *i-th* 的部分為 ``i / (m + " +"1)``。給定九個樣本資料,此方法將對資料排序且計算下列百分位數:10%、20%、30%、" +"40%、50%、60%、70%、80%、90%。" #: ../../library/statistics.rst:605 msgid "" @@ -855,6 +880,11 @@ msgid "" "assigns the following percentiles: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, " "80%, 90%, 100%." msgstr "" +"若將 *method* 設為 \"inclusive\",則用於描述母體或者已知包含母體中最極端值的樣" +"本資料。在 *data* 中的最小值被視為第 0 百分位數,最大值為第 100 百分位數。對" +"於 *m* 個已排序的資料點,計算出低於 *i-th* 的部分為 ``(i - 1) / (m - 1)``。給" +"定十一個個樣本資料,此方法將對資料排序且計算下列百分位數:0%、10%、20%、30%、" +"40%、50%、60%、70%、80%、90%、100%。" #: ../../library/statistics.rst:629 msgid "" From 2b3fae40aec03776fc2992fe326263907a2a9fd1 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 11 Jul 2023 14:31:14 +0800 Subject: [PATCH 03/26] translate how venv works (#457) * translate how venv works * Apply suggestions from code review * Apply suggestions from code review --- library/venv.po | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/venv.po b/library/venv.po index edabd97b3b..4279e0d4bb 100644 --- a/library/venv.po +++ b/library/venv.po @@ -208,7 +208,7 @@ msgstr "" #: ../../library/venv.rst:50 msgid "How venvs work" -msgstr "" +msgstr "虛擬環境如何運作" #: ../../library/venv.rst:52 msgid "" @@ -219,6 +219,10 @@ msgid "" "environment. It is sufficient to check ``sys.prefix != sys.base_prefix`` to " "determine if the current interpreter is running from a virtual environment." msgstr "" +"當 Python 直譯器跑在虛擬環境時,:data:`sys.prefix` 和 :data:`sys.exec_prefix` 會指" +"向虛擬環境的目錄,而 :data:`sys.base_prefix` 和 :data:`sys.base_exec_prefix` " +"會指向建立虛擬環境的基礎 Python 的目錄。檢查 ``sys.prefix != sys." +"base_prefix`` 就可以確定目前的直譯器是否跑在虛擬環境中。" #: ../../library/venv.rst:61 msgid "" From baa27cc3b5eacb1a9332a927ab9f190a5d63c5e5 Mon Sep 17 00:00:00 2001 From: Jay <74105438+weijay0804@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:55:43 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E7=BF=BB=E8=AD=AF=20=20Pure=20paths=20?= =?UTF-8?q?=E6=AE=B5=E8=90=BD=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 翻譯 Pure paths 段落 * fix: 修復 `Inline literal start-string without end-string` 問題 * 重新整理 rST 語法翻譯時的格式 * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * 將 pure path 翻譯成 純路徑 * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/pathlib.po Co-authored-by: Wei-Hsiang (Matt) Wang --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/pathlib.po | 50 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/library/pathlib.po b/library/pathlib.po index 1b8fcddffe..c8e9146a6a 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-11 00:16+0000\n" -"PO-Revision-Date: 2018-05-23 16:07+0000\n" +"PO-Revision-Date: 2023-07-10 17:18+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-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.3.2\n" #: ../../library/pathlib.rst:3 msgid ":mod:`pathlib` --- Object-oriented filesystem paths" @@ -101,7 +102,7 @@ msgstr "" #: ../../library/pathlib.rst:94 msgid "Pure paths" -msgstr "" +msgstr "純路徑" #: ../../library/pathlib.rst:96 msgid "" @@ -109,12 +110,18 @@ msgid "" "access a filesystem. There are three ways to access these classes, which we " "also call *flavours*:" msgstr "" +"純路徑物件提供處理路徑的操作,實際上不會存取檔案系統。有三種方法可以存取" +"這些類別 (class),我們也稱之為\\ *類型*:" #: ../../library/pathlib.rst:102 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`):\n" +"\n" +"::" #: ../../library/pathlib.rst:108 msgid "" @@ -122,22 +129,38 @@ msgid "" "segment, an object implementing the :class:`os.PathLike` interface which " "returns a string, or another path object::" msgstr "" +"*pathsegments* 中的每個元素可以是以下三種的其中一種:一個表示路徑片段的字串、實" +"作了 :class:`os.PathLike` 介面 (interface) 並回傳字串的物件,或者另一個路徑物" +"件:\n" +"\n" +"::" #: ../../library/pathlib.rst:117 msgid "When *pathsegments* is empty, the current directory is assumed::" msgstr "" +"當 *pathsegments* 是空的時候,預設使用目前的目錄:\n" +"\n" +"::" #: ../../library/pathlib.rst:122 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" msgstr "" +"如果一個片段是絕對路徑,則所有先前的片段將被忽略(類似於 :func:`os.path." +"join`):\n" +"\n" +"::" #: ../../library/pathlib.rst:130 msgid "" "On Windows, the drive is not reset when a rooted relative path segment (e." "g., ``r'\\foo'``) is encountered::" msgstr "" +"在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁碟" +"機 (drive) 部分不會被重置:\n" +"\n" +"::" #: ../../library/pathlib.rst:136 msgid "" @@ -145,6 +168,11 @@ msgid "" "and leading double slashes (``'//'``) are not, since this would change the " "meaning of a path for various reasons (e.g. symbolic links, UNC paths)::" msgstr "" +"不必要的斜線和單點會被合併,但雙點 (``'..'``) 和前置的雙斜線 (``'//'``) 不會" +"被合併,因為這樣會因為各種原因改變路徑的意義(例如符號連結 (symbolic links)、" +"UNC 路徑):\n" +"\n" +"::" #: ../../library/pathlib.rst:149 msgid "" @@ -152,40 +180,54 @@ msgid "" "``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link to " "another directory)" msgstr "" +"(一個使得 ``PurePosixPath('foo/../bar')`` 等同於 ``PurePosixPath('bar')`` " +"的單純方法,但如果 ``foo`` 是一個目錄的符號連結,這是錯誤的。)" #: ../../library/pathlib.rst:153 msgid "" "Pure path objects implement the :class:`os.PathLike` interface, allowing " "them to be used anywhere the interface is accepted." msgstr "" +"純路徑物件實作了 :class:`os.PathLike` 介面,使得它們可以在任何接受該介面的地" +"方使用。" #: ../../library/pathlib.rst:156 msgid "Added support for the :class:`os.PathLike` interface." -msgstr "" +msgstr "新增了對於 :class:`os.PathLike` 介面的支援。" #: ../../library/pathlib.rst:161 msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" +":class:`PurePath` 的一個子類別 (subclass),該路徑類型表示非 Windows 檔案系統的" +"路徑:\n" +"\n" +"::" #: ../../library/pathlib.rst:167 ../../library/pathlib.rst:179 #: ../../library/pathlib.rst:672 ../../library/pathlib.rst:682 #: ../../library/pathlib.rst:692 msgid "*pathsegments* is specified similarly to :class:`PurePath`." -msgstr "" +msgstr "*pathsegments* 的指定方式與 :class:`PurePath` 類似。" #: ../../library/pathlib.rst:171 msgid "" "A subclass of :class:`PurePath`, this path flavour represents Windows " "filesystem paths, including `UNC paths`_::" msgstr "" +":class:`PurePath` 的一個子類別,該路徑類型表示 Windows 檔案系統的路徑,包括 " +" `UNC paths`_:\n" +"\n" +"::" #: ../../library/pathlib.rst:183 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." msgstr "" +"不論你使用的是什麼系統,你都可以實例化這些類別,因為它們不提供任何涉" +"及系統呼叫 (system calls) 的操作。" #: ../../library/pathlib.rst:188 msgid "General properties" From fdf906d61f10cf5603e5397b8dc5e50a545f4d49 Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Tue, 11 Jul 2023 18:07:51 +0800 Subject: [PATCH 05/26] Add translations of `library/statistics.po` (#465) * Add translations of covariance, correlation and linear_regression * Update library/statistics.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/statistics.po Co-authored-by: Wei-Hsiang (Matt) Wang * Update library/statistics.po Co-authored-by: Wei-Hsiang (Matt) Wang --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/statistics.po | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/library/statistics.po b/library/statistics.po index 9a704d35bf..270f984ef4 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-03 00:17+0000\n" -"PO-Revision-Date: 2023-07-09 21:14+0800\n" +"PO-Revision-Date: 2023-07-10 23:56+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -251,7 +251,7 @@ msgstr ":func:`linear_regression`" #: ../../library/statistics.rst:108 msgid "Slope and intercept for simple linear regression." -msgstr "簡單線性回歸的斜率和截距。" +msgstr "簡單線性迴歸的斜率和截距。" #: ../../library/statistics.rst:113 msgid "Function details" @@ -864,8 +864,8 @@ msgid "" "them and assigns the following percentiles: 10%, 20%, 30%, 40%, 50%, 60%, " "70%, 80%, 90%." msgstr "" -"預設的 *method* 是 \"exclusive\",用於從可能找到比樣本更極端的值的母體中抽樣的" -"樣本資料。對於 *m* 個已排序的資料點,計算出低於 *i-th* 的部分為 ``i / (m + " +"預設的 *method* 是 \"exclusive\",用於從可能找到比樣本更極端的值的母體中抽樣" +"的樣本資料。對於 *m* 個已排序的資料點,計算出低於 *i-th* 的部分為 ``i / (m + " "1)``。給定九個樣本資料,此方法將對資料排序且計算下列百分位數:10%、20%、30%、" "40%、50%、60%、70%、80%、90%。" @@ -880,23 +880,26 @@ msgid "" "assigns the following percentiles: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, " "80%, 90%, 100%." msgstr "" -"若將 *method* 設為 \"inclusive\",則用於描述母體或者已知包含母體中最極端值的樣" -"本資料。在 *data* 中的最小值被視為第 0 百分位數,最大值為第 100 百分位數。對" -"於 *m* 個已排序的資料點,計算出低於 *i-th* 的部分為 ``(i - 1) / (m - 1)``。給" -"定十一個個樣本資料,此方法將對資料排序且計算下列百分位數:0%、10%、20%、30%、" -"40%、50%、60%、70%、80%、90%、100%。" +"若將 *method* 設為 \"inclusive\",則用於描述母體或者已知包含母體中最極端值的" +"樣本資料。在 *data* 中的最小值被視為第 0 百分位數,最大值為第 100 百分位數。" +"對於 *m* 個已排序的資料點,計算出低於 *i-th* 的部分為 ``(i - 1) / (m - 1)``。" +"給定十一個個樣本資料,此方法將對資料排序且計算下列百分位數:0%、10%、20%、" +"30%、40%、50%、60%、70%、80%、90%、100%。" #: ../../library/statistics.rst:629 msgid "" "Return the sample covariance of two inputs *x* and *y*. Covariance is a " "measure of the joint variability of two inputs." msgstr "" +"回傳兩輸入 *x* 與 *y* 的樣本共變異數 (sample covariance)。共變異數是衡量兩輸" +"入的聯合變異性 (joint variability) 的指標。" #: ../../library/statistics.rst:632 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" +"兩輸入必須具有相同長度(至少兩個),否則會引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:653 msgid "" @@ -907,12 +910,18 @@ msgid "" "linear relationship, -1 very strong, negative linear relationship, and 0 no " "linear relationship." msgstr "" +"回傳兩輸入的 `Pearson 相關係數 (Pearson’s correlation coefficient) `。Pearson 相關係數 " +"*r* 的值介於 -1 與 +1 之間。它衡量線性關係的強度與方向,其中 +1 表示強烈正線" +"性相關,-1 表示強烈負線性相關,而 0 表示無線性關係。" #: ../../library/statistics.rst:660 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`。" #: ../../library/statistics.rst:678 msgid "" @@ -922,6 +931,11 @@ msgid "" "between an independent variable *x* and a dependent variable *y* in terms of " "this linear function:" msgstr "" +"回傳使用普通最小平方法 (ordinary least square) 估計出的\\ `簡單線性迴歸 " +"(simple linear regression) `_ 參數中的斜率 (slope) 與截距 (intercept)。簡單線性" +"迴歸描述自變數 (independent variable) *x* 與應變數 (dependent variable) *y* " +"之間的關係,用以下的線性函式表示:" #: ../../library/statistics.rst:684 msgid "*y = slope \\* x + intercept + noise*" @@ -934,6 +948,8 @@ msgid "" "explained by the linear regression (it is equal to the difference between " "predicted and actual values of the dependent variable)." msgstr "" +"其中 ``slope`` 和 ``intercept`` 是被估計的迴歸參數,而 ``noise`` 表示由線性迴" +"歸未解釋的資料變異性(它等於應變數的預測值與實際值之差)。" #: ../../library/statistics.rst:692 msgid "" @@ -941,6 +957,8 @@ msgid "" "independent variable *x* cannot be constant; otherwise a :exc:" "`StatisticsError` is raised." msgstr "" +"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引發 :exc:" +"`StatisticsError`。" #: ../../library/statistics.rst:696 msgid "" @@ -949,6 +967,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 電影的累計數量。" #: ../../library/statistics.rst:710 msgid "" @@ -957,6 +978,9 @@ msgid "" "line passing through the origin. Since the *intercept* will always be 0.0, " "the underlying linear function simplifies to:" msgstr "" +"若將 *proportional* 設為 True,則假設自變數 *x* 與應變數" +" *y* 是直接成比例的,資料座落在通過原點的一直線上。由於 *intercept* " +"始終為 0.0,因此線性函式可簡化如下:" #: ../../library/statistics.rst:716 msgid "*y = slope \\* x + noise*" From f59d4d4d1b41388a0cd3295e3a7c9a164562b955 Mon Sep 17 00:00:00 2001 From: poliyka <58025341+poliyka@users.noreply.github.com> Date: Wed, 12 Jul 2023 00:43:51 +0800 Subject: [PATCH 06/26] Translate pathlib.rst:1008 to pathlib.rst:1158 (18) (#461) * pathlib: 1008 translated * Translated all part of line 1008 to 1158 * Fix few words * Add space around number --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/pathlib.po | 51 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/library/pathlib.po b/library/pathlib.po index c8e9146a6a..666f3e4456 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -787,26 +787,37 @@ msgid "" "Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's uid isn't found in the system database." msgstr "" +"回傳擁有該檔案的用戶的名稱。如果在系統資料庫中找不到該檔案的 uid ,則會引發 :" +"exc:`KeyError`。" #: ../../library/pathlib.rst:1014 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "" +"將指向檔案的二進制內容以一個位元組 (bytes) 物件回傳:\n" +"\n" +"::" #: ../../library/pathlib.rst:1027 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "" +"將指向檔案的解碼內容以字串形式回傳:\n" +"\n" +"::" #: ../../library/pathlib.rst:1035 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." -msgstr "" +msgstr "該檔案被打開並且隨後關閉。選填參數的含義與 :func:`open` 函數中的相同。" #: ../../library/pathlib.rst:1043 msgid "" "Return the path to which the symbolic link points (as returned by :func:`os." "readlink`)::" msgstr "" +"回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值):\n" +"\n" +"::" #: ../../library/pathlib.rst:1056 msgid "" @@ -816,6 +827,12 @@ msgid "" "*target* exists, :exc:`FileExistsError` will be raised. *target* can be " "either a string or another path object::" msgstr "" +"將此檔案或目錄重新命名為所提供的 *target* ,並回傳一個新的路徑 (Path) 物件指" +"向該 *target* 。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權" +"限,則會在不顯示訊息的情況下進行取代。在 Windows 系統上,若 *target* 存在,則" +"會引發 :exc:`FileExistsError` 錯誤。*target* 可以是字串或另一個路徑物件:\n" +"\n" +"::" #: ../../library/pathlib.rst:1071 ../../library/pathlib.rst:1087 msgid "" @@ -823,16 +840,18 @@ msgid "" "relative to the current working directory, *not* the directory of the Path " "object." msgstr "" +"目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於當前的工作目錄進行解釋," +"*not* 相對於路徑物件所在的目錄。" #: ../../library/pathlib.rst:1075 msgid "" "It is implemented in terms of :func:`os.rename` and gives the same " "guarantees." -msgstr "" +msgstr "此功能是使用 :func:`os.rename` 實現的,並提供相同的保證。" #: ../../library/pathlib.rst:1077 ../../library/pathlib.rst:1091 msgid "Added return value, return the new Path instance." -msgstr "" +msgstr "新增了回傳值,回傳新的路徑 (Path) 物件。" #: ../../library/pathlib.rst:1083 msgid "" @@ -840,24 +859,35 @@ msgid "" "instance pointing to *target*. If *target* points to an existing file or " "empty directory, it will be unconditionally replaced." msgstr "" +"將此檔案或目錄重新命名為給定的 *target* ,並回傳一個指向 *target* 的新路徑物" +"件。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" #: ../../library/pathlib.rst:1097 msgid "" "Make the path absolute, without normalization or resolving symlinks. Returns " "a new path object::" msgstr "" +"使路徑成為絕對路徑,不進行標準化或解析符號連結。 回傳一個新的路徑物件:\n" +"\n" +"::" #: ../../library/pathlib.rst:1109 msgid "" "Make the path absolute, resolving any symlinks. A new path object is " "returned::" msgstr "" +"將路徑轉換為絕對路徑,解析所有符號連結。回傳一個新的路徑物件:\n" +"\n" +"::" #: ../../library/pathlib.rst:1118 msgid "" "\"``..``\" components are also eliminated (this is the only method to do " "so)::" msgstr "" +"同時也會消除 \"``..``\" 的路徑組件(這是唯一的方法):\n" +"\n" +"::" #: ../../library/pathlib.rst:1124 msgid "" @@ -867,16 +897,24 @@ msgid "" "If an infinite loop is encountered along the resolution path, :exc:" "`RuntimeError` is raised." msgstr "" +"如果路徑不存在且 *strict* 為 ``True``, 則引發 :exc:`FileNotFoundError`。如" +"果 *strict* 為 ``False``, 則將盡可能解析該路徑,並將任何剩餘部分追加到路徑" +"中,而不檢查其是否存在。 如果在解析過程中遇到無窮迴圈,則引發 :exc:" +"`RuntimeError`。" #: ../../library/pathlib.rst:1130 msgid "The *strict* argument (pre-3.6 behavior is strict)." -msgstr "" +msgstr "*strict* 引數(在 3.6 版本之前的行為是嚴格的)。" #: ../../library/pathlib.rst:1135 msgid "" "This is like calling :func:`Path.glob` with \"``**/``\" added in front of " "the given relative *pattern*::" msgstr "" +"這相當於在給定的相對 *pattern* 前面加上 \"``**/``\" 並呼叫 :func:`Path.glob` " +":\n" +"\n" +"::" #: ../../library/pathlib.rst:1145 msgid "" @@ -888,7 +926,7 @@ msgstr "" #: ../../library/pathlib.rst:1153 msgid "Remove this directory. The directory must be empty." -msgstr "" +msgstr "移除此目錄。該目錄必須為空。" #: ../../library/pathlib.rst:1158 msgid "" @@ -896,6 +934,9 @@ msgid "" "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`。" #: ../../library/pathlib.rst:1162 msgid "" From 3387f323cfbf4be84e243af63f9d511996862155 Mon Sep 17 00:00:00 2001 From: sweslo17 Date: Wed, 12 Jul 2023 01:19:29 +0800 Subject: [PATCH 07/26] Translate library/pathlib::General properties (#455) * translate General properties * fix term: hashable translate conflict * fix according to reviewer's recommandation * fix translation * fix duplicated wording --- library/pathlib.po | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/library/pathlib.po b/library/pathlib.po index 666f3e4456..f2626c8473 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-11 00:16+0000\n" -"PO-Revision-Date: 2023-07-10 17:18+0800\n" +"PO-Revision-Date: 2023-07-11 01:08+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.3.2\n" +"X-Generator: Poedit 3.3.1\n" #: ../../library/pathlib.rst:3 msgid ":mod:`pathlib` --- Object-oriented filesystem paths" @@ -231,7 +231,7 @@ msgstr "" #: ../../library/pathlib.rst:188 msgid "General properties" -msgstr "" +msgstr "通用特性" #: ../../library/pathlib.rst:190 msgid "" @@ -239,14 +239,16 @@ msgid "" "comparable and orderable. These properties respect the flavour's case-" "folding semantics::" msgstr "" +"路徑物件是不可變 (immutable) 且 :term:`hashable` (可雜湊)的。相同類型的路" +"徑物件可以被比較和排序。這些特性遵守該類型的大小寫規則:" #: ../../library/pathlib.rst:203 msgid "Paths of a different flavour compare unequal and cannot be ordered::" -msgstr "" +msgstr "不同類型的路徑物件在比較時視為不相等且無法被排序:" #: ../../library/pathlib.rst:214 msgid "Operators" -msgstr "" +msgstr "運算子" #: ../../library/pathlib.rst:216 msgid "" @@ -255,12 +257,15 @@ msgid "" "the drive is not reset when the argument is a rooted relative path (e.g., " "``r'\\foo'``)::" msgstr "" +"斜線運算子(slash operator)用於建立子路徑,就像是 :func:`os.path.join` 函式" +"一樣。如果引數是絕對路徑,則忽略前一個路徑。在 Windows 系統上,當引數是以根目" +"錄為基礎的相對路徑(例如,``r’\\foo’``),磁碟路徑不會被重置:" #: ../../library/pathlib.rst:234 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" -msgstr "" +msgstr "路徑物件可以被用在任何可以使用 :class:`os.PathLike` 的地方:" #: ../../library/pathlib.rst:242 msgid "" From 938280c884c8d274d48463a1e49e6f5f280b9d35 Mon Sep 17 00:00:00 2001 From: emily40830 Date: Wed, 12 Jul 2023 10:46:29 +0800 Subject: [PATCH 08/26] Translate venv 225 (#452) * docs: Add venv 225 * fix: Fix syntax * fix: Remove untranslated line --------- Co-authored-by: emily_c_wang --- library/venv.po | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/venv.po b/library/venv.po index 4279e0d4bb..7529a10d37 100644 --- a/library/venv.po +++ b/library/venv.po @@ -482,6 +482,8 @@ msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" msgstr "" +"回傳的內容物件(context object)其型別會是 :class:`types.SimpleNamespace`," +"並包含以下屬性:" #: ../../library/venv.rst:228 msgid "" From ca1538f7d94c1a850b681908fbb7fe163abcf38a Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Thu, 13 Jul 2023 00:01:48 +0800 Subject: [PATCH 09/26] Adds more translations of `library/statistics.po` objects. (#470) * Adds more translations of NormalDist objects. * Small fixes --- library/statistics.po | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/library/statistics.po b/library/statistics.po index 270f984ef4..b7926b56dd 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-03 00:17+0000\n" -"PO-Revision-Date: 2023-07-10 23:56+0800\n" +"PO-Revision-Date: 2023-07-12 23:16+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -911,7 +911,7 @@ msgid "" "linear relationship." msgstr "" "回傳兩輸入的 `Pearson 相關係數 (Pearson’s correlation coefficient) `。Pearson 相關係數 " +"en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_。Pearson 相關係數 " "*r* 的值介於 -1 與 +1 之間。它衡量線性關係的強度與方向,其中 +1 表示強烈正線" "性相關,-1 表示強烈負線性相關,而 0 表示無線性關係。" @@ -968,8 +968,8 @@ msgid "" "2019 assuming that they had kept the pace." msgstr "" "舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們保持固" -"定的製作速度,應該會產生的 Monty Python 電影的累計數量。" +"wikipedia.org/wiki/Monty_Python#Films>`_\\ 來預測至 2019 年為止,假設他們保持" +"固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" #: ../../library/statistics.rst:710 msgid "" @@ -978,9 +978,9 @@ msgid "" "line passing through the origin. Since the *intercept* will always be 0.0, " "the underlying linear function simplifies to:" msgstr "" -"若將 *proportional* 設為 True,則假設自變數 *x* 與應變數" -" *y* 是直接成比例的,資料座落在通過原點的一直線上。由於 *intercept* " -"始終為 0.0,因此線性函式可簡化如下:" +"若將 *proportional* 設為 True,則假設自變數 *x* 與應變數 *y* 是直接成比例的," +"資料座落在通過原點的一直線上。由於 *intercept* 始終為 0.0,因此線性函式可簡化" +"如下:" #: ../../library/statistics.rst:716 msgid "*y = slope \\* x + noise*" @@ -996,11 +996,11 @@ msgstr "例外" #: ../../library/statistics.rst:726 msgid "A single exception is defined:" -msgstr "" +msgstr "定義了一個單一的例外:" #: ../../library/statistics.rst:730 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." -msgstr "" +msgstr ":exc:`ValueError` 的子類別,用於和統計相關的異常。" #: ../../library/statistics.rst:734 msgid ":class:`NormalDist` objects" @@ -1013,6 +1013,9 @@ msgid "" "Courses/1997-98/101/ranvar.htm>`_. It is a class that treats the mean and " "standard deviation of data measurements as a single entity." msgstr "" +":class:`NormalDist` 是一種用於建立與操作\\ `隨機變數 (random variable) " +"`_ 的常態分布的工" +"具。它是一個將量測資料的平均數與標準差視為單一實體的類別。" #: ../../library/statistics.rst:742 msgid "" @@ -1020,6 +1023,8 @@ msgid "" "wikipedia.org/wiki/Central_limit_theorem>`_ and have a wide range of " "applications in statistics." msgstr "" +"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" #: ../../library/statistics.rst:748 msgid "" @@ -1027,34 +1032,44 @@ msgid "" "`_ and *sigma* represents the " "`standard deviation `_." msgstr "" +"此方法會回傳一個新 *NormalDist* 物件,其中 *mu* 代表\\ `算數平均數 `_\\ 而 *sigma* 代表\\ `標準差 " +"`_。" #: ../../library/statistics.rst:753 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." -msgstr "" +msgstr "若 *sigma* 為負值,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:757 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." msgstr "" +"常態分布中的\\ `算數平均數 `_\\ 唯讀屬性。" #: ../../library/statistics.rst:763 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" +"常態分布中的\\ `中位數 `_\\ 唯讀屬性。" #: ../../library/statistics.rst:769 msgid "" "A read-only property for the `mode `_ of a normal distribution." msgstr "" +"常態分布中的\\ `眾數 `_\\ 唯" +"讀屬性。" #: ../../library/statistics.rst:775 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." msgstr "" +"常態分布中的\\ `標準差 `_\\ 唯讀屬性。" #: ../../library/statistics.rst:781 msgid "" @@ -1062,12 +1077,16 @@ msgid "" "Variance>`_ of a normal distribution. Equal to the square of the standard " "deviation." msgstr "" +"常態分布中的\\ `變異數 `_\\ 唯讀屬" +"性。" #: ../../library/statistics.rst:787 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." msgstr "" +"利用 :func:`fmean` 與 :func:`stdev` 函式,估計 *data* 的 *mu* 與 *sigma* 參" +"數,建立一個常態分布的實例。" #: ../../library/statistics.rst:790 msgid "" @@ -1077,6 +1096,9 @@ msgid "" "point to estimate a central value and at least two points to estimate " "dispersion." msgstr "" +"*data* 可以是任何 :term:`iterable`,並應包含可以轉換為 :class:`float` 的值。" +"若 *data* 沒有包含至少兩個以上的元素在內,則引發 :exc:`StatisticsError`,因為" +"至少需要一個點來估計中央值且至少需要兩個點來估計分散情形。" #: ../../library/statistics.rst:798 msgid "" From 5a62e2cb011d04999e13cae5dbde7f58ab8bbfdb Mon Sep 17 00:00:00 2001 From: Jay <74105438+weijay0804@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:04:39 +0800 Subject: [PATCH 10/26] =?UTF-8?q?docs(howto/sockets.po):=20=E7=BF=BB?= =?UTF-8?q?=E8=AD=AF=20sockets.rst:5=20=E5=88=B0=20sockets.rst:106=20?= =?UTF-8?q?=E5=8D=80=E5=A1=8A=20(#471)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(howto/sockets.po): 翻譯 sockets.rst:5 到 sockets.rst:106 區塊 gh-466 * docs(howto/sockets.po): 去除不必要的空白 gh-466 * docs(howto/sockets.po): 修改名詞、文法 修改成更適合的名詞、文法,標點符號 gh-466 --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- howto/sockets.po | 67 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/howto/sockets.po b/howto/sockets.po index 16681602c9..89b38480cc 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-06-10 00:16+0000\n" -"PO-Revision-Date: 2018-05-23 14:37+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2023-07-12 02:22+0800\n" +"Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,10 +17,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.3.2\n" #: ../../howto/sockets.rst:5 msgid "Socket Programming HOWTO" -msgstr "" +msgstr "Socket 程式設計指南" #: ../../howto/sockets.rst:0 msgid "Author" @@ -43,6 +44,10 @@ msgid "" "a lot of them), but I hope it will give you enough background to begin using " "them decently." msgstr "" +"Sockets 在各處都被廣泛使用,但卻是一項被誤解最嚴重的技術之一。這是一篇對 " +"sockets 的概論介紹。這並不是一個完整的教學指南 - 你還需要做許多準備才能讓 " +"sockets 正常運作。這篇文章也沒有包含細節(其中有非常多的細節),但我希望這篇" +"文章能夠讓你有足夠的背景知識,以便開始正確的使用 sockets 程式設計。" #: ../../howto/sockets.rst:20 msgid "Sockets" @@ -59,6 +64,13 @@ msgid "" "blocking sockets. But I'll start by talking about blocking sockets. You'll " "need to know how they work before dealing with non-blocking sockets." msgstr "" +"我只會討論關於 INET(例如:IPv4)的 sockets,但它們涵蓋了幾乎 99% 的 " +"sockets 使用場景。而我也將僅討論關於 STREAM(比如:TCP)類型的 sockets - 除" +"非你真的知道你在做什麼(在這種情況下,這份指南可能不適合你),使用 STREAM " +"類型的 socket 會獲得比其他 sockets 類型更好的表現和性能。我將會嘗試解釋 " +"socket 是什麼,以及如何使用阻塞 (blocking) 和非阻塞 (non-blocking) sockets 的" +"一些建議。但首先我會先談論阻塞 sockets。在處理非阻塞 sockets 之前,你需要了解" +"它們的工作原理。" #: ../../howto/sockets.rst:31 msgid "" @@ -70,10 +82,16 @@ msgid "" "sockets exclusively; the web server it's talking to uses both \"server\" " "sockets and \"client\" sockets." msgstr "" +"要理解這些東西的困難點之一在於 \"scoket\" 可以代表多種具有些微差異的東西,這主要" +"取決於上下文。所以首先,讓我們先區分「用戶端 (client)」socket 和「伺服器端" +" (server)」socket 的差別,「用戶端」socket 表示通訊的一端,「伺服器端」" +"socket 更像是一個電話總機接線員。用戶端應用程式(例如:你的瀏覽器)只能使" +"用「用戶端」socket; 它所連接的網路伺服器則同時使用「伺服器端」socket 和 " +"「用戶端」socket 來進行通訊。" #: ../../howto/sockets.rst:40 msgid "History" -msgstr "" +msgstr "歷史" #: ../../howto/sockets.rst:42 msgid "" @@ -82,6 +100,9 @@ msgid "" "other forms of IPC that are faster, but for cross-platform communication, " "sockets are about the only game in town." msgstr "" +"在各種形式的 :abbr:`IPC (Inter Process Communication)` 中,sockets 是最受歡迎" +"的。在任何特定的平台上,可能會存在其他更快速的 IPC 形式,但對於跨平台通訊來" +"說,sockets 是唯一的選擇。" #: ../../howto/sockets.rst:47 msgid "" @@ -90,16 +111,22 @@ msgid "" "of sockets with INET makes talking to arbitrary machines around the world " "unbelievably easy (at least compared to other schemes)." msgstr "" +"Sockets 作為 Unix 的 BSD 分支的一部分在 Berkeley 被發明出來。它們隨著網際網路的普" +"及而迅速蔓延開來。這是有很好的理由 — sockets 和 INET 的結合讓世界各地任何" +"的機器之間的通訊變得非常簡單(至少與其它方案相比是如此)。" #: ../../howto/sockets.rst:54 msgid "Creating a Socket" -msgstr "" +msgstr "建立一個 Socket" #: ../../howto/sockets.rst:56 msgid "" "Roughly speaking, when you clicked on the link that brought you to this " "page, your browser did something like the following::" msgstr "" +"大致上來說,當你點擊了帶你來到這個頁面的連結時,你的瀏覽器做了以下的操作:\n" +"\n" +"::" #: ../../howto/sockets.rst:64 msgid "" @@ -108,12 +135,19 @@ msgid "" "then be destroyed. That's right, destroyed. Client sockets are normally only " "used for one exchange (or a small set of sequential exchanges)." msgstr "" +"當 ``connect`` 完成時,這個 socket ``s`` 可以用來發送請求來取得頁面的文本。同" +"一個 socket 也會讀取回傳值,然後再被銷毀。是的,會被銷毀。用戶端 socket 通常只" +"用來做一次交換(或是一小組連續交換)。" #: ../../howto/sockets.rst:70 msgid "" "What happens in the web server is a bit more complex. First, the web server " "creates a \"server socket\"::" msgstr "" +"網路伺服器 (web server) 的運作就稍微複雜一點。首先,網路伺服器會建立一個「伺服器端 " +"socket」:\n" +"\n" +"::" #: ../../howto/sockets.rst:80 msgid "" @@ -124,6 +158,10 @@ msgid "" "machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any " "address the machine happens to have." msgstr "" +"有幾件事需要注意:我們使用了 ``socket.gethostname()``,這樣 socket 才能對外" +"部網路可見。如果我們使用了 ``s.bind(('localhost', 80))`` 或 ``s." +"bind(('127.0.0.1', 80))``,我們會得到一個「伺服器端」socket,但是只能在同一" +"台機器內可見。``s.bind(('', 80))`` 指定 socket 可以透過機器的任何地址存取。" #: ../../howto/sockets.rst:87 msgid "" @@ -131,6 +169,8 @@ msgid "" "known\" services (HTTP, SNMP etc). If you're playing around, use a nice high " "number (4 digits)." msgstr "" +"第二個要注意的是:數字小的連接埠 (port) 通常保留給「廣為人知的」服務(HTTP、SNMP" +"等)。如果你只是想執行程式,可以使用一個數字較大的連接埠(4 位數字)。" #: ../../howto/sockets.rst:91 msgid "" @@ -139,12 +179,19 @@ msgid "" "outside connections. If the rest of the code is written properly, that " "should be plenty." msgstr "" +"最後,``listen`` 引數告訴 socket 函式庫 (library),我們希望在佇列 (queue) 中" +"累積達 5 個(正常的最大值)連接請求後再拒絕外部連接。如果其餘的程式碼編寫" +"正確,這應該足夠了。" #: ../../howto/sockets.rst:95 msgid "" "Now that we have a \"server\" socket, listening on port 80, we can enter the " "mainloop of the web server::" msgstr "" +"現在我們有一個監聽 80 連接埠的「伺服器端」socket 了,我們可以進入網路伺服器的" +"主迴圈了:\n" +"\n" +"::" #: ../../howto/sockets.rst:106 msgid "" @@ -161,6 +208,16 @@ msgid "" "The two \"clients\" are free to chat it up - they are using some dynamically " "allocated port which will be recycled when the conversation ends." msgstr "" +"事實上,有三種方法可以讓這個迴圈運作 - 分配一個執行緒 (thread) 來處理 " +"``clientsocket`` 、建立一個新行程 (process) 來處理 ``clientsocket``,或者將" +"這個程式重新改寫成使用非阻塞 socket,並使用 ``select`` 在我們的「伺服器端」" +"socket 和任何有效的 ``clientsocket`` 之間進行多工處理。稍後將會更詳細的介紹。" +"現在最重要的是理解:這就是「伺服器端」socket 做的\\ *所有* \\事情。它不會發送任何" +"資料、也不接收任何資料,它只會建立「伺服器端」socket。每個 ``clientsocket`` " +"都是為了回應某些\\ *其他* \\ ``connect()`` 到我們綁定的主機上的「用戶端」socket。" +"一但 ``clientsocket`` 建立完成,就會繼續監聽更多的連接請求。兩個「用戶端」可" +"以隨意的通訊 - 它們使用的是一些動態分配的連接埠,會在通訊結束的時候被回收並重新" +"利用。" #: ../../howto/sockets.rst:121 msgid "IPC" From 545e8a44382acfa8848bedd2b11f6c32f1b7cca6 Mon Sep 17 00:00:00 2001 From: RockLeon <34214497+rockleona@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:05:08 +0800 Subject: [PATCH 11/26] #444 Transalte API venv.rst:140 to venv.rst:218 (#460) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Working on API venv.rst:140 to venv.rst:173 * Fix Typo on venv.rst:140 * 1. Fix Typo '目錄' 2. Finish translate until venv.rst:218 * Fix Format with poedit * Fix typo and suggestions * Update with reviewer's comment * Update with reviewer's comment --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/venv.po | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/library/venv.po b/library/venv.po index 7529a10d37..64a8512b80 100644 --- a/library/venv.po +++ b/library/venv.po @@ -372,12 +372,15 @@ msgid "" "customize environment creation according to their needs, the :class:" "`EnvBuilder` class." msgstr "" +"上述提到的高階 method(方法)透過簡單的 API 使用, 為第三方虛擬環境建立者" +"提供可以依據他們需求來建立環境的客製化機制: :class:`EnvBuilder` " +"class。" #: ../../library/venv.rst:148 msgid "" "The :class:`EnvBuilder` class accepts the following keyword arguments on " "instantiation:" -msgstr "" +msgstr "進行實例化時,class :class:`EnvBuilder` 接受下列的關鍵字引數:" #: ../../library/venv.rst:151 msgid "" @@ -385,18 +388,24 @@ msgid "" "Python site-packages should be available to the environment (defaults to " "``False``)." msgstr "" +"``system_site_packages`` -- 為一個 Boolean (布林值),並表明系統的 Python " +"site-packages 是否可以在環境中可用(預設為 ``False`` )。" #: ../../library/venv.rst:154 msgid "" "``clear`` -- a Boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." msgstr "" +"``clear`` -- 為一個 Boolean,如果為 true,則在建立環境之前,刪除目" +"標目錄內所有存在的內容。" #: ../../library/venv.rst:157 msgid "" "``symlinks`` -- a Boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." msgstr "" +"``symlinks`` -- 為一個 Boolean,並表明是否嘗試與 Python 二進位檔案建" +"立符號連結而不是複製該檔案。" #: ../../library/venv.rst:160 msgid "" @@ -404,6 +413,8 @@ msgid "" "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``)。" #: ../../library/venv.rst:164 msgid "" @@ -411,6 +422,8 @@ msgid "" "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" "pip`` option." msgstr "" +"``with_pip`` -- 為一個 Boolean,若為 true,則確保 pip 有安裝至虛擬" +"環境之中。當有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" #: ../../library/venv.rst:168 msgid "" @@ -419,10 +432,13 @@ msgid "" "used). If the special string ``\".\"`` is provided, the basename of the " "current directory is used as the prompt." msgstr "" +"``prompt`` -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設" +"為 ``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當" +"前目錄的 basename 會做為提示路徑使用。" #: ../../library/venv.rst:173 msgid "``upgrade_deps`` -- Update the base venv modules to the latest on PyPI" -msgstr "" +msgstr "``upgrade_deps`` -- 更新基礎 venv 模組至 PyPI 的最新版本" #: ../../library/venv.rst:175 ../../library/venv.rst:350 msgid "Added the ``with_pip`` parameter" @@ -441,10 +457,12 @@ msgid "" "Creators of third-party virtual environment tools will be free to use the " "provided :class:`EnvBuilder` class as a base class." msgstr "" +"第三方虛擬環境工具的建立者可以自由地使用 :class:`EnvBuilder` class 作" +"為 base class(基底類別)使用." #: ../../library/venv.rst:187 msgid "The returned env-builder is an object which has a method, ``create``:" -msgstr "" +msgstr "回傳的 env-builder 為一個物件,且帶有一個 method ``create``:" #: ../../library/venv.rst:191 msgid "" @@ -453,12 +471,18 @@ msgid "" "environment. The ``create`` method will either create the environment in " "the specified directory, or raise an appropriate exception." msgstr "" +"透過指定將會容納虛擬環境的目標目錄來建立一個虛擬環境(絕對路徑或" +"相對路徑到該目錄),也就是在該目錄中容納虛擬環境。" +"``create`` method 將會在指定的目錄下建立環境,或是觸發" +"適當的例外。" #: ../../library/venv.rst:197 msgid "" "The ``create`` method of the :class:`EnvBuilder` class illustrates the hooks " "available for subclass customization::" msgstr "" +":class:`EnvBuilder` class 的 ``create`` method 會闡述可用的 " +"Hooks 以客製化 subclass (子類別)::" #: ../../library/venv.rst:212 msgid "" @@ -466,6 +490,9 @@ msgid "" "`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" "meth:`post_setup` can be overridden." msgstr "" +"每個 methods :meth:`ensure_directories`、:meth:" +"`create_configuration`、:meth:`setup_python`、:meth:`setup_scripts` 及 :meth:" +"`post_setup` 都可以被覆寫。" #: ../../library/venv.rst:218 msgid "" @@ -476,13 +503,17 @@ msgid "" "of the environment directory will be cleared and then all necessary " "subdirectories will be recreated." msgstr "" +"建立還不存在的環境目錄及必要的子目錄,並回傳一個情境物件(context object)。這個情境物件" +"只是一個屬性 (例如:路徑) 的所有者,可被其他 method 使用。如" +"果 :class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內" +"容將被清空,以及所有必要的子目錄將被重新建立。" #: ../../library/venv.rst:225 msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" msgstr "" -"回傳的內容物件(context object)其型別會是 :class:`types.SimpleNamespace`," +"回傳的情境物件(context object)其型別會是 :class:`types.SimpleNamespace`," "並包含以下屬性:" #: ../../library/venv.rst:228 From 4132e011fe9d465e4322ae47d25b5d1310044c65 Mon Sep 17 00:00:00 2001 From: Jackson <56949000+jacksonchen1998@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:28:56 +0800 Subject: [PATCH 12/26] [UPDATE] Translate `os.path.po` (#469) * [UPDATE] Translate `os.path.po` * Update library/os.path.po Co-authored-by: Wei-Hsiang (Matt) Wang * [UPDATE] fix rst format * [UDAPTE] fix rst format * [UPDATE] * [UPDATE] local build sucess * [UPDATE] fix typo * [UPDATE] Modified some terms --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/os.path.po | 70 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/library/os.path.po b/library/os.path.po index f1ec83dbbb..52e6a1bf8c 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" -"PO-Revision-Date: 2018-05-23 16:07+0000\n" -"Last-Translator: Adrian Liaw \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-" "tw)\n" "Language: zh_TW\n" @@ -17,18 +17,19 @@ 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.3.2\n" #: ../../library/os.path.rst:2 msgid ":mod:`os.path` --- Common pathname manipulations" -msgstr "" +msgstr ":mod:`os.path` --- 常見的路徑名操作" #: ../../library/os.path.rst:7 msgid "" "**Source code:** :source:`Lib/posixpath.py` (for POSIX) and :source:`Lib/" "ntpath.py` (for Windows)." msgstr "" -"**原始碼:**\\ :source:`Lib/posixpath.py`\\ (對於 POSIX)與 :source:`Lib/" -"ntpath.py`\\(對於 Windows)。" +"**原始碼:** :source:`Lib/posixpath.py` (用於 POSIX 系統) 和 :source:`Lib/" +"ntpath.py` (用於 Windows)." #: ../../library/os.path.rst:14 msgid "" @@ -37,6 +38,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` 協議實作的物件傳遞。" #: ../../library/os.path.rst:19 msgid "" @@ -45,10 +49,13 @@ msgid "" "explicitly when an application desires shell-like path expansion. (See also " "the :mod:`glob` module.)" msgstr "" +"與 Unix shell 不同,Python 不會\\ *自動*\\ 進行路徑展開(path expansions)。" +"當應用程式需要進行類似 shell 的路徑展開時,可以明確地呼叫 :func:`expanduser` " +"和 :func:`expandvars` 等函式。(另請參閱 :mod:`glob` 模組。)" #: ../../library/os.path.rst:26 msgid "The :mod:`pathlib` module offers high-level path objects." -msgstr "" +msgstr ":mod:`pathlib` 模組提供了高階的路徑物件。" #: ../../library/os.path.rst:31 msgid "" @@ -56,6 +63,8 @@ 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 msgid "" @@ -67,14 +76,18 @@ msgid "" "path that is *always* in one of the different formats. They all have the " "same interface:" msgstr "" +"由於不同的作業系統具有不同的路徑命名慣例,在標準函式庫中的路徑模組有數個版本" +"可供使用,而 :mod:`os.path` 模組都會是運行 Python 之作業系統所適用本地路徑。" +"然而,如果你想要操作\\ *始終*\\ 以某個不同於本機格式表示的路徑,你也可以引入" +"並使用對應的模組。它們都具有相同的介面:" #: ../../library/os.path.rst:45 msgid ":mod:`posixpath` for UNIX-style paths" -msgstr "" +msgstr ":mod:`posixpath` 用於 UNIX 形式的路徑" #: ../../library/os.path.rst:46 msgid ":mod:`ntpath` for Windows paths" -msgstr "" +msgstr ":mod:`ntpath` 用於 Windows 的路徑" #: ../../library/os.path.rst:51 msgid "" @@ -83,6 +96,9 @@ msgid "" "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``,而不是引發例外。" #: ../../library/os.path.rst:59 msgid "" @@ -90,6 +106,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))``。" #: ../../library/os.path.rst:63 ../../library/os.path.rst:76 #: ../../library/os.path.rst:116 ../../library/os.path.rst:125 @@ -105,7 +123,7 @@ msgstr "" #: ../../library/os.path.rst:437 ../../library/os.path.rst:453 #: ../../library/os.path.rst:478 ../../library/os.path.rst:509 msgid "Accepts a :term:`path-like object`." -msgstr "" +msgstr "接受一個 :term:`path-like object`。" #: ../../library/os.path.rst:69 msgid "" @@ -115,6 +133,10 @@ msgid "" "program; where :program:`basename` for ``'/foo/bar/'`` returns ``'bar'``, " "the :func:`basename` function returns an empty string (``''``)." msgstr "" +"回傳路徑名 *path* 的基底名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳結" +"果中的第二個元素。請注意,此函式的結果與 Unix 的 :program:`basename` 程式不" +"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``,而 :func:" +"`basename` 函式回傳空字串(``''``)。" #: ../../library/os.path.rst:82 msgid "" @@ -123,6 +145,9 @@ msgid "" "relative pathnames, the *paths* are on the different drives or if *paths* is " "empty. Unlike :func:`commonprefix`, this returns a valid path." msgstr "" +"回傳序列 *paths* 中每個路徑名的最長共同子路徑。如果 *paths* 同時包含絕對路徑" +"和相對路徑、*paths* 位於不同的磁碟機或 *paths* 為空,則引發 :exc:" +"`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" #: ../../library/os.path.rst:88 ../../library/os.path.rst:388 #: ../../library/os.path.rst:400 ../../library/os.path.rst:416 @@ -132,7 +157,7 @@ msgstr ":ref:`適用 `:Unix、Windows。" #: ../../library/os.path.rst:92 msgid "Accepts a sequence of :term:`path-like objects `." -msgstr "" +msgstr "接受一個\\ :term:`類路徑物件 `\\ 的序列。" #: ../../library/os.path.rst:98 msgid "" @@ -140,18 +165,24 @@ msgid "" "prefix of all paths in *list*. If *list* is empty, return the empty string " "(``''``)." msgstr "" +"回傳 *list* 中所有路徑的最長路徑前綴(逐字元比較)。如果 *list* 為空,則回傳" +"空字串(``''``)。" #: ../../library/os.path.rst:104 msgid "" "This function may return invalid paths because it works a character at a " "time. To obtain a valid path, see :func:`commonpath`." msgstr "" +"由於此函式是逐字元比較,因此可能會回傳無效的路徑。若要獲得有效的路徑,請參" +"考 :func:`commonpath` 函式。" #: ../../library/os.path.rst:122 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`." msgstr "" +"回傳路徑名 *path* 的目錄名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳之" +"成對結果中的第一個元素。" #: ../../library/os.path.rst:131 msgid "" @@ -161,12 +192,17 @@ msgid "" "to execute :func:`os.stat` on the requested file, even if the *path* " "physically exists." msgstr "" +"如果 *path* 是一個存在的路徑或一個開啟的檔案描述器則回傳 ``True``。對於已損壞" +"的符號連結則回傳 ``False``。在某些平台上,即使 *path* 實際存在,如果未被授予" +"執行 :func:`os.stat` 的權限,此函式仍可能回傳 ``False``。" #: ../../library/os.path.rst:137 msgid "" "*path* can now be an integer: ``True`` is returned if it is an open file " "descriptor, ``False`` otherwise." msgstr "" +"現在 *path* 可以是一個整數:如果它是一個開啟的檔案描述器,則回傳 ``True``;否" +"則回傳 ``False``。" #: ../../library/os.path.rst:147 msgid "" @@ -174,12 +210,16 @@ msgid "" "broken symbolic links. Equivalent to :func:`exists` on platforms lacking :" "func:`os.lstat`." msgstr "" +"如果 *path* 是一個存在的路徑則回傳 ``True``。對於已損壞的符號連結也回傳 " +"``True``。在缺乏 :func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" #: ../../library/os.path.rst:159 msgid "" "On Unix and Windows, return the argument with an initial component of ``~`` " "or ``~user`` replaced by that *user*'s home directory." msgstr "" +"在 Unix 和 Windows 上,將引數中以 ``~`` 或 ``~user`` 開頭的部分替換為該 " +"*user* 的家目錄。" #: ../../library/os.path.rst:164 msgid "" @@ -188,6 +228,9 @@ msgid "" "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` 在密碼目錄中查找當前使用者的家目錄。對" +"於初始的 ``~user``,直接在密碼目錄中查找該使用者的家目錄。" #: ../../library/os.path.rst:169 msgid "" @@ -197,16 +240,21 @@ msgid "" "of the current user's home directory matches :envvar:`USERNAME`, and " "replacing it if so." msgstr "" +"在 Windows 上,如果 :envvar:`USERPROFILE` 有被設置,則使用該變數的值;否則將" +"結合 :envvar:`HOMEPATH` 和 :envvar:`HOMEDRIVE`。對於初始的 ``~user``,會檢查" +"當前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" +"則替換它。" #: ../../library/os.path.rst:174 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:180 msgid "No longer uses :envvar:`HOME` on Windows." -msgstr "" +msgstr "在 Windows 上不再使用 :envvar:`HOME` 變數。" #: ../../library/os.path.rst:189 msgid "" From e8a7a0ebb43c9d82a834bad7d3a0afb223feaf04 Mon Sep 17 00:00:00 2001 From: RockLeon <34214497+rockleona@users.noreply.github.com> Date: Fri, 14 Jul 2023 02:13:54 +0800 Subject: [PATCH 13/26] Readme Update (#472) * Update Glossary Part * Found a Broken Link in Translation Resource * Update zh-CN doc link --- README.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 58ccd25b71..7e56b0e5af 100644 --- a/README.rst +++ b/README.rst @@ -318,10 +318,10 @@ rST 語法注意事項 =============== 為了讓翻譯保持統一,我們整理了一份 `術語列表 -`_ \ -如果翻譯過程中你覺得需要術語列表有所缺漏,請填寫 `術語列表擴充表單 \ -`_。新增的術語,將會於每次\ -Sprint中共同討論是否合併進術語列表。 +`_ \ +如果翻譯過程中你覺得需要術語列表有所缺漏,請至 `Discussion \ +`_ 開啟新的討論補充術語。\ +新增的術語,將會於每次 Sprint 中共同討論是否合併進術語列表。 @@ -346,7 +346,7 @@ Sprint中共同討論是否合併進術語列表。 - `Doc-SIG mailing list `_ - `PEP 545 `_ - `zh_CN Translation of the Python Documentation - `_ + `_ - `Cambridge Dictionary `_ From 010898f4b4dd79e3ba53e133abaae6fdcf6364a9 Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:40:49 +0800 Subject: [PATCH 14/26] Adds more translations of `NormalDist` object of `library/statistics.po` (#473) * Adds more translations of NormalDist object of library/statistics.po * Small fixes --- library/statistics.po | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/library/statistics.po b/library/statistics.po index b7926b56dd..8f6d9b5062 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-03 00:17+0000\n" -"PO-Revision-Date: 2023-07-12 23:16+0800\n" +"PO-Revision-Date: 2023-07-14 00:44+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -1000,7 +1000,7 @@ msgstr "定義了一個單一的例外:" #: ../../library/statistics.rst:730 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." -msgstr ":exc:`ValueError` 的子類別,用於和統計相關的異常。" +msgstr ":exc:`ValueError` 的子類別,用於和統計相關的例外。" #: ../../library/statistics.rst:734 msgid ":class:`NormalDist` objects" @@ -1105,6 +1105,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`。" #: ../../library/statistics.rst:801 msgid "" @@ -1112,6 +1114,8 @@ msgid "" "generator. This is useful for creating reproducible results, even in a " "multi-threading context." msgstr "" +"若有給定 *seed*,則會建立一個以此為基礎的亂數產生器實例。這對於建立可重現的結" +"果很有幫助,即使在多執行緒情境下也是如此。" #: ../../library/statistics.rst:807 msgid "" @@ -1120,6 +1124,10 @@ 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 < " +"x+dx) / dx`` 在 *dx* 趨近於零時的極限值。" #: ../../library/statistics.rst:813 msgid "" @@ -1128,6 +1136,8 @@ msgid "" "\"density\"). Since the likelihood is relative to other points, its value " "can be greater than ``1.0``." msgstr "" +"相對概度是樣本出現在狹窄範圍的機率,除以該範圍的寬度(故稱為「密度」)計算而" +"得。由於概度是相對於其它點,故其值可大於 ``1.0``。" #: ../../library/statistics.rst:820 msgid "" @@ -1136,6 +1146,9 @@ 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)``。" #: ../../library/statistics.rst:827 msgid "" @@ -1145,6 +1158,11 @@ msgid "" "statisticshowto.datasciencecentral.com/inverse-distribution-function/>`_ " "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" +"計算反累計分布函式 (inverse cumulative distribution function),也稱為\\ `分位" +"數函式 (quantile function) `_ 或者\\ `百分率點 (percent-point) `_ 函式。數學上記為 ``x : P(X <= x) = p``。" #: ../../library/statistics.rst:833 msgid "" @@ -1152,6 +1170,7 @@ msgid "" "the variable being less than or equal to that value equals the given " "probability *p*." msgstr "" +"找出一個值 *x*,使得隨機變數 *X* 小於或等於該值的機率等於給定的機率 *p*。" #: ../../library/statistics.rst:839 msgid "" @@ -1159,12 +1178,16 @@ msgid "" "a value between 0.0 and 1.0 giving `the overlapping area for the two " "probability density functions `_." msgstr "" +"衡量兩常態分布之間的一致性。回傳一個介於 0.0 與 1.0 之間的值,表示\\ `兩機率" +"密度函式的重疊區域 `_。" #: ../../library/statistics.rst:846 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." msgstr "" +"將常態分布分割成 *n* 個具有相等機率的連續區間。回傳一個 list,包含 (n-1) 個切" +"割區間的分隔點。" #: ../../library/statistics.rst:850 msgid "" @@ -1172,6 +1195,9 @@ msgid "" "*n* to 100 for percentiles which gives the 99 cuts points that separate the " "normal distribution into 100 equal sized groups." msgstr "" +"將 *n* 設定為 4 表示四分位數(預設值)。將 *n* 設定為 10 表示十分位數。將 " +"*n* 設定為 100 表示百分位數,這會產生 99 個分隔點,將常態分布切割成大小相等的" +"群組。" #: ../../library/statistics.rst:856 msgid "" @@ -1180,6 +1206,9 @@ msgid "" "deviations above or below the mean of the normal distribution: ``(x - " "mean) / stdev``." msgstr "" +"計算\\ `標準分數 (Standard Score) `_,用以描述在常態分布中,*x* 高出或低於" +"平均數幾個標準差:``(x - mean) / stdev``。" #: ../../library/statistics.rst:864 msgid "" @@ -1187,6 +1216,8 @@ msgid "" "multiplication and division by a constant. These operations are used for " "translation and scaling. For example:" msgstr "" +":class:`NormalDist` 的實例支援對常數的加法、減法、乘法與除法。這些操作用於平" +"移與縮放。例如:" #: ../../library/statistics.rst:874 msgid "" @@ -1205,11 +1236,11 @@ msgstr "" #: ../../library/statistics.rst:897 msgid ":class:`NormalDist` Examples and Recipes" -msgstr "" +msgstr ":class:`NormalDist` 範例與錦囊妙計" #: ../../library/statistics.rst:899 msgid ":class:`NormalDist` readily solves classic probability problems." -msgstr "" +msgstr ":class:`NormalDist` 可以輕易地解決經典的機率問題。" #: ../../library/statistics.rst:901 msgid "" @@ -1225,6 +1256,8 @@ msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" msgstr "" +"找出 SAT 分數的\\ `四分位數 `_\\ 以及" +"\\ `十分位數 `_:" #: ../../library/statistics.rst:924 msgid "" From 9ae50c2ef49840097c1ba4b666e11d94837f2a31 Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:01:50 +0800 Subject: [PATCH 15/26] Adds more translations of `library/io` (#478) * Adds more translations of library/io --- library/io.po | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/library/io.po b/library/io.po index 9bfb9a5145..44b4cd6031 100644 --- a/library/io.po +++ b/library/io.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 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" -"PO-Revision-Date: 2018-05-23 16:04+0000\n" +"PO-Revision-Date: 2023-07-17 17:38+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,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.3.2\n" #: ../../library/io.rst:2 msgid ":mod:`io` --- Core tools for working with streams" @@ -65,7 +65,7 @@ msgstr "" #: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1122 msgid "Text I/O" -msgstr "" +msgstr "文字 I/O" #: ../../library/io.rst:53 msgid "" @@ -94,7 +94,7 @@ msgstr "" #: ../../library/io.rst:72 ../../library/io.rst:1110 msgid "Binary I/O" -msgstr "" +msgstr "二進位 (Binary) I/O" #: ../../library/io.rst:74 msgid "" @@ -120,17 +120,19 @@ msgstr "" msgid "" "The binary stream API is described in detail in the docs of :class:" "`BufferedIOBase`." -msgstr "" +msgstr "二進位資料串流 API 的詳細說明在 :class:`BufferedIOBase` 文件當中。" #: ../../library/io.rst:92 msgid "" "Other library modules may provide additional ways to create text or binary " "streams. See :meth:`socket.socket.makefile` for example." msgstr "" +"其它函式庫模組可能提供額外的方法來建立文字或二進位資料串流。例如 :meth:" +"`socket.socket.makefile`。" #: ../../library/io.rst:97 msgid "Raw I/O" -msgstr "" +msgstr "原始 (Raw) I/O" #: ../../library/io.rst:99 msgid "" @@ -143,17 +145,19 @@ msgstr "" #: ../../library/io.rst:106 msgid "" "The raw stream API is described in detail in the docs of :class:`RawIOBase`." -msgstr "" +msgstr "原始串流 API 在 :class:`RawIOBase` 文件中有詳細描述。" #: ../../library/io.rst:112 msgid "Text Encoding" -msgstr "" +msgstr "文字編碼" #: ../../library/io.rst:114 msgid "" "The default encoding of :class:`TextIOWrapper` and :func:`open` is locale-" "specific (:func:`locale.getencoding`)." msgstr "" +":class:`TextIOWrapper` 和 :func:`open` 預設編碼是根據區域設定的 (locale-" +"specific) (:func:`locale.getencoding`)。" #: ../../library/io.rst:117 msgid "" @@ -162,6 +166,9 @@ msgid "" "platforms use UTF-8 locale by default. This causes bugs because the locale " "encoding is not UTF-8 for most Windows users. For example::" msgstr "" +"然而,許多開發人員在開啟以 UTF-8 編碼的文字檔案(例如:JSON、TOML、Markdown" +"等)時忘記指定編碼,因為多數 Unix 平台預設使用 UTF-8 區域設定。這會導致錯誤," +"因為對於大多數 Windows 使用者來說,預設地區編碼並非 UTF-8。舉例來說:" #: ../../library/io.rst:126 msgid "" @@ -170,6 +177,9 @@ msgid "" "``encoding=\"utf-8\"``. To use the current locale encoding, " "``encoding=\"locale\"`` is supported since Python 3.10." msgstr "" +"因此,強烈建議在開啟文字檔案時,明確指定編碼。若你想使用 UTF-8 編碼,請傳入 " +"``encoding=\"utf-8\"``。若想使用目前的地區編碼,Python 3.10 以後的版本支援使" +"用 ``encoding=\"locale\"``。" #: ../../library/io.rst:135 msgid ":ref:`utf8-mode`" @@ -179,7 +189,7 @@ msgstr ":ref:`utf8-mode`" msgid "" "Python UTF-8 Mode can be used to change the default encoding to UTF-8 from " "locale-specific encoding." -msgstr "" +msgstr "在 Python UTF-8 模式下,可以將預設編碼從特定地區編碼改為 UTF-8。" #: ../../library/io.rst:137 msgid ":pep:`686`" @@ -187,11 +197,11 @@ msgstr ":pep:`686`" #: ../../library/io.rst:138 msgid "Python 3.15 will make :ref:`utf8-mode` default." -msgstr "" +msgstr "Python 3.15 將預設使用 :ref:`utf8-mode`。" #: ../../library/io.rst:143 msgid "Opt-in EncodingWarning" -msgstr "" +msgstr "選擇性加入的編碼警告" #: ../../library/io.rst:145 msgid "See :pep:`597` for more details." From 9f5f0c8d14d69d191c4afff2335827c83c220af0 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 18 Jul 2023 11:23:49 +0800 Subject: [PATCH 16/26] Translate `library/netrc.po` (#476) * feat: translate `library/netrc.po` * fix(library/netrc): modify based on review comments * fix(library/netrc): no translation for `token` --- library/netrc.po | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/library/netrc.po b/library/netrc.po index ea3d70be8f..9c63fe0d4d 100644 --- a/library/netrc.po +++ b/library/netrc.po @@ -1,15 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2023, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Matt Wang , 2023 msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" -"Last-Translator: Adrian Liaw \n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -20,7 +20,7 @@ msgstr "" #: ../../library/netrc.rst:3 msgid ":mod:`netrc` --- netrc file processing" -msgstr "" +msgstr ":mod:`netrc` --- netrc 檔案處理" #: ../../library/netrc.rst:11 msgid "**Source code:** :source:`Lib/netrc.py`" @@ -31,6 +31,8 @@ msgid "" "The :class:`~netrc.netrc` class parses and encapsulates the netrc file " "format used by the Unix :program:`ftp` program and other FTP clients." msgstr "" +":class:`~netrc.netrc` 類別能夠剖析 (parse) 並封裝 (encapsulate) netrc 檔案格" +"式,以供 Unix :program:`ftp` 程式和其他 FTP 用戶端使用。" #: ../../library/netrc.rst:21 msgid "" @@ -48,16 +50,27 @@ msgid "" "security behavior equivalent to that of ftp and other programs that use :" "file:`.netrc`." msgstr "" +":class:`~netrc.netrc` 實例或其子類別實例能夠封裝來自 netrc 檔案的資料。可用初" +"始化引數(如有給定)指定要剖析的檔案,如果未給定引數,則將讀取(由 :func:`os." +"path.expanduser` 指定的)使用者主目錄中的 :file:`.netrc` 檔案,否則將引發 :" +"exc:`FileNotFoundError` 例外。剖析錯誤會引發 :exc:`NetrcParseError`,其帶有包" +"括檔案名稱、列號和終止 token 的診斷資訊。如果在 POSIX 系統上未指定引數,且若" +"檔案所有權或權限不安全(擁有者與運行該行程的使用者不同,或者可供任何其他使用" +"者讀取或寫入),存有密碼的 :file:`.netrc` 檔案將會引發 :exc:" +"`NetrcParseError`。這實作了與 ftp 和其他使用 :file:`.netrc` 程式等效的安全行" +"為。" #: ../../library/netrc.rst:35 msgid "Added the POSIX permission check." -msgstr "" +msgstr "新增了 POSIX 權限檢查。" #: ../../library/netrc.rst:37 msgid "" ":func:`os.path.expanduser` is used to find the location of the :file:`." "netrc` file when *file* is not passed as argument." msgstr "" +"當未傳遞 *file* 引數時,:func:`os.path.expanduser` 可用於查找 :file:`.netrc` " +"檔案的位置。" #: ../../library/netrc.rst:41 msgid "" @@ -68,6 +81,10 @@ msgid "" "characters. If the login name is anonymous, it won't trigger the security " "check." msgstr "" +":class:`netrc` 在使用特定語言環境編碼前會先嘗試 UTF-8 編碼。netrc 檔案中的條" +"目就不再需要包含所有 token,缺少的 token 值被預設為空字串。現在所有 token 及" +"其值都可以包含任意字元,例如空格和非 ASCII 字元。如果登入名稱為匿名,就不會觸" +"發安全檢查。" #: ../../library/netrc.rst:52 msgid "" @@ -77,6 +94,9 @@ msgid "" "attr:`filename` is the name of the source file, and :attr:`lineno` gives the " "line number on which the error was found." msgstr "" +"當原始文本中遇到語法錯誤時,:class:`~netrc.netrc` 類別會引發例外。此例外的實" +"例提供了三個有趣的屬性::attr:`msg` 是該錯誤的文字解釋、:attr:`filename` 是原" +"始檔案的名稱、:attr:`lineno` 給出發現錯誤的列號。" #: ../../library/netrc.rst:62 msgid "netrc Objects" @@ -84,7 +104,7 @@ msgstr "netrc 物件" #: ../../library/netrc.rst:64 msgid "A :class:`~netrc.netrc` instance has the following methods:" -msgstr "" +msgstr ":class:`~netrc.netrc` 實例具有以下方法:" #: ../../library/netrc.rst:69 msgid "" @@ -93,23 +113,30 @@ msgid "" "return the tuple associated with the 'default' entry. If neither matching " "host nor default entry is available, return ``None``." msgstr "" +"回傳 *host* 身份驗證器的三元素 tuple ``(login, account, password)``。如果 " +"netrc 檔案不包含給定主機的條目,則回傳與 'default' 條目關聯的 tuple。如果並無" +"匹配主機且預設條目也不可用則回傳 ``None``。" #: ../../library/netrc.rst:77 msgid "" "Dump the class data as a string in the format of a netrc file. (This " "discards comments and may reorder the entries.)" msgstr "" +"將類別資料傾印 (dump) 為 netrc 檔案格式的字串。(這會將註解移除,並可能會對條" +"目重新排序。)" #: ../../library/netrc.rst:80 msgid "Instances of :class:`~netrc.netrc` have public instance variables:" -msgstr "" +msgstr ":class:`~netrc.netrc` 的實例具有公開實例變數:" #: ../../library/netrc.rst:85 msgid "" "Dictionary mapping host names to ``(login, account, password)`` tuples. The " "'default' entry, if any, is represented as a pseudo-host by that name." msgstr "" +"將主機名稱對映到 ``(login, account, password)`` tuple 的字典。'default' 條目" +"(如存在)表示為該名稱對應到的偽主機 (pseudo-host)。" #: ../../library/netrc.rst:91 msgid "Dictionary mapping macro names to string lists." -msgstr "" +msgstr "巨集 (macro) 名稱與字串 list(串列)的對映字典。" From dee2ae3b8e6be5958526dc287ddcd295f346f99d Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:50:49 +0800 Subject: [PATCH 17/26] Finishes the translation of `library/statistics.po` (#474) * Adds more translations of library/statistics.po --- library/statistics.po | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/library/statistics.po b/library/statistics.po index 8f6d9b5062..375ba27f0f 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-03 00:17+0000\n" -"PO-Revision-Date: 2023-07-14 00:44+0800\n" +"PO-Revision-Date: 2023-07-17 18:00+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -1224,6 +1224,7 @@ 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:877 msgid "" @@ -1233,6 +1234,10 @@ msgid "" "Sum_of_normally_distributed_random_variables>`_ represented as instances of :" "class:`NormalDist`. For example:" msgstr "" +"由於常態分布源自於自變數的加法效應 (additive effects),因此可以\\ `將兩個獨立" +"的常態分布隨機變數相加與相減 `_,並且表示為 :class:" +"`NormalDist` 的實例。例如:" #: ../../library/statistics.rst:897 msgid ":class:`NormalDist` Examples and Recipes" @@ -1250,6 +1255,9 @@ msgid "" "determine the percentage of students with test scores between 1100 and 1200, " "after rounding to the nearest whole number:" msgstr "" +"例如,給定 `SAT 測驗的歷史資料 `_,顯示成績為平均 1060、標準差 195 的常態分布。我們要" +"求出分數在 1100 與 1200 之間(四捨五入至最接近的整數)的學生的百分比:" #: ../../library/statistics.rst:914 msgid "" @@ -1265,6 +1273,9 @@ msgid "" "analytically, :class:`NormalDist` can generate input samples for a `Monte " "Carlo simulation `_:" msgstr "" +"欲估計一個不易透過解析方法求解的模型的分布,:class:`NormalDist` 可以產生輸入" +"樣本以進行 `Monte Carlo 模擬 `_:" #: ../../library/statistics.rst:940 msgid "" @@ -1272,6 +1283,9 @@ msgid "" "`_ when the sample " "size is large and when the probability of a successful trial is near 50%." msgstr "" +"當樣本數量夠大,且試驗成功的機率接近 50%,可以使用常態分布來近似\\ `二項分布 " +"(Binomial distributions) `_。" #: ../../library/statistics.rst:945 msgid "" @@ -1281,10 +1295,14 @@ msgid "" "talks. Assuming the population preferences haven't changed, what is the " "probability that the Python room will stay within its capacity limits?" msgstr "" +"例如,一場有 750 位參加者的開源研討會中,有兩間可容納 500 人的會議室。一場是" +"關於 Python 的講座,另一場則是關於 Ruby 的。在過去的會議中,有 65% 的參加者傾" +"向參與 Python 講座。假設參與者的偏好沒有改變,那麼 Python 會議室未超過自身容" +"量限制的機率是?" #: ../../library/statistics.rst:976 msgid "Normal distributions commonly arise in machine learning problems." -msgstr "" +msgstr "常態分布常在機器學習問題中出現。" #: ../../library/statistics.rst:978 msgid "" @@ -1293,6 +1311,9 @@ msgid "" "challenge is to predict a person's gender from measurements of normally " "distributed features including height, weight, and foot size." msgstr "" +"維基百科有個 `Naive Bayesian Classifier 的優良範例 `_。課題為從身高、體重與鞋" +"子尺寸等符合常態分布的特徵量測值中判斷一個人的性別。" #: ../../library/statistics.rst:983 msgid "" @@ -1300,12 +1321,14 @@ msgid "" "measurements are assumed to be normally distributed, so we summarize the " "data with :class:`NormalDist`:" msgstr "" +"給定一組包含八個人的量測值的訓練資料集。假設這些量測值服從常態分布,我們可以" +"利用 :class:`NormalDist` 來總結資料:" #: ../../library/statistics.rst:996 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" -msgstr "" +msgstr "接著,我們遇到一個新的人,他的特徵量測值已知,但性別未知:" #: ../../library/statistics.rst:1005 msgid "" @@ -1314,6 +1337,9 @@ msgid "" "the prior times the product of likelihoods for the feature measurements " "given the gender:" msgstr "" +"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior probability) " +"計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" #: ../../library/statistics.rst:1020 msgid "" @@ -1321,3 +1347,6 @@ msgid "" "`maximum a posteriori `_ or MAP:" msgstr "" +"最終的預測結果將取決於最大的後驗機率。這被稱為\\ `最大後驗機率 (maximum a " +"posteriori) `_ 或者 MAP:" From a9f07c05fc6401c4054cc0b50070aecda2d6c035 Mon Sep 17 00:00:00 2001 From: RockLeon <34214497+rockleona@users.noreply.github.com> Date: Tue, 18 Jul 2023 17:47:54 +0800 Subject: [PATCH 18/26] Add Discussion Template for Adding Terms to Glossary (#481) * Add Discussion Template for Adding Terms to Glosarry * Fix typo * Update with reviewer's comment * update typo --- .github/DISSCUSSION_TEMPLATE/add_term.yml | 55 +++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/DISSCUSSION_TEMPLATE/add_term.yml diff --git a/.github/DISSCUSSION_TEMPLATE/add_term.yml b/.github/DISSCUSSION_TEMPLATE/add_term.yml new file mode 100644 index 0000000000..76bd602a2c --- /dev/null +++ b/.github/DISSCUSSION_TEMPLATE/add_term.yml @@ -0,0 +1,55 @@ +body: + - type: markdown + attributes: + value: | + 感謝你參與本翻譯計畫 🚀 + + 謝謝你願意補充術語,讓志工們的翻譯流程更順暢 🙏 + + 接下來請麻煩依照下列的步驟完成術語補充,我們將在下一次的 meetup 討論新增的術語,並整理至術語表當中。 + + - type: checkboxes + id: steps_check + attributes: + label: 初步確認 + description: 請確認下列每個步驟都已經完成。 + options: + - label: 我已經確認過 [術語列表](https://github.com/python/python-docs-zh-tw/wiki/%E8%A1%93%E8%AA%9E%E5%88%97%E8%A1%A8) 中沒有相關術語。 + required: true + - label: 我已經確認過 [Python 官方術語列表](https://docs.python.org/zh-tw/3/glossary.html) 中沒有相關術語。 + required: true + + - type: input + id: term_eng + attributes: + label: 術語原文 + description: | + + validations: + required: true + + - type: input + id: term_zh + attributes: + label: 術語翻譯 + description: | + + validations: + required: true + + - type: textarea + id: description + attributes: + label: 說明 + description: | + 請補充說明原文出處和想新增詞彙的原因。 + + validations: + required: true + + + - type: textarea + id: reference + attributes: + label: 參考資料 + description: 若有其他參考資料,也請麻煩附上,可以加速 reviewer 的作業流程喔。 \ No newline at end of file From adfa77490215854e2a5b810c7c15a1695a0a339b Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 18 Jul 2023 22:58:43 +0800 Subject: [PATCH 19/26] fix: typo of duscussion template --- .../{DISSCUSSION_TEMPLATE => DISCUSSION_TEMPLATE}/add_term.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{DISSCUSSION_TEMPLATE => DISCUSSION_TEMPLATE}/add_term.yml (100%) diff --git a/.github/DISSCUSSION_TEMPLATE/add_term.yml b/.github/DISCUSSION_TEMPLATE/add_term.yml similarity index 100% rename from .github/DISSCUSSION_TEMPLATE/add_term.yml rename to .github/DISCUSSION_TEMPLATE/add_term.yml From c1e88a7eb16c9bf6661c71fdff145a6eca406a0a Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 18 Jul 2023 23:07:22 +0800 Subject: [PATCH 20/26] fix: typo of duscussion template name --- .github/DISCUSSION_TEMPLATE/{add_term.yml => add-term.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/DISCUSSION_TEMPLATE/{add_term.yml => add-term.yml} (100%) diff --git a/.github/DISCUSSION_TEMPLATE/add_term.yml b/.github/DISCUSSION_TEMPLATE/add-term.yml similarity index 100% rename from .github/DISCUSSION_TEMPLATE/add_term.yml rename to .github/DISCUSSION_TEMPLATE/add-term.yml From 665154d83696d33e0cacf41b416915455c06bfb4 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 18 Jul 2023 23:16:28 +0800 Subject: [PATCH 21/26] fix: rm empty description in duscussion template --- .github/DISCUSSION_TEMPLATE/add-term.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/DISCUSSION_TEMPLATE/add-term.yml b/.github/DISCUSSION_TEMPLATE/add-term.yml index 76bd602a2c..b4723d65ac 100644 --- a/.github/DISCUSSION_TEMPLATE/add-term.yml +++ b/.github/DISCUSSION_TEMPLATE/add-term.yml @@ -23,8 +23,6 @@ body: id: term_eng attributes: label: 術語原文 - description: | - validations: required: true @@ -32,8 +30,6 @@ body: id: term_zh attributes: label: 術語翻譯 - description: | - validations: required: true From 0da1846aefd0a0994360cc662920daab51c3bacf Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 00:24:58 +0800 Subject: [PATCH 22/26] Sync with CPython 3.11 (#442) * sync with cpython e0d951d6 * sync with cpython ada22db1 * sync with cpython 80117dd4 * sync with cpython 2d037fb4 * sync with cpython dd046973 * sync with cpython 247f0500 * sync with cpython a276ce45 * sync with cpython 21862121 * sync with cpython c73f9c04 * sync with cpython a7acc5cb * sync with cpython 38553442 * fix: resolve fuzzy entries --------- Co-authored-by: github-actions[bot] Co-authored-by: Matt Wang --- howto/clinic.po | 590 +++++++++-------- library/asyncio-exceptions.po | 12 +- library/crypt.po | 65 +- library/exceptions.po | 38 +- library/functions.po | 6 +- library/sqlite3.po | 655 +++++++++---------- library/stdtypes.po | 763 +++++++++++----------- library/typing.po | 1145 +++++++++++++++++---------------- library/urllib.parse.po | 11 +- reference/expressions.po | 32 +- reference/simple_stmts.po | 4 +- tutorial/controlflow.po | 250 +++---- tutorial/errors.po | 18 +- 13 files changed, 1807 insertions(+), 1782 deletions(-) diff --git a/howto/clinic.po b/howto/clinic.po index 7239faccba..a9b49c94fd 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-07-18 15:00+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-" @@ -54,11 +54,11 @@ msgid "" "totally incompatible and break all your code." msgstr "" -#: ../../howto/clinic.rst:31 -msgid "The Goals Of Argument Clinic" +#: ../../howto/clinic.rst:32 +msgid "The goals of Argument Clinic" msgstr "" -#: ../../howto/clinic.rst:33 +#: ../../howto/clinic.rst:34 msgid "" "Argument Clinic's primary goal is to take over responsibility for all " "argument parsing code inside CPython. This means that, when you convert a " @@ -69,7 +69,7 @@ msgid "" "*kwargs``) magically converted into the C variables and types you need." msgstr "" -#: ../../howto/clinic.rst:43 +#: ../../howto/clinic.rst:44 msgid "" "In order for Argument Clinic to accomplish its primary goal, it must be easy " "to use. Currently, working with CPython's argument parsing library is a " @@ -77,7 +77,7 @@ msgid "" "places. When you use Argument Clinic, you don't have to repeat yourself." msgstr "" -#: ../../howto/clinic.rst:49 +#: ../../howto/clinic.rst:50 msgid "" "Obviously, no one would want to use Argument Clinic unless it's solving " "their problem—and without creating new problems of its own. So it's " @@ -89,14 +89,14 @@ msgid "" "parsing library. That would make for the fastest argument parsing possible!)" msgstr "" -#: ../../howto/clinic.rst:61 +#: ../../howto/clinic.rst:62 msgid "" "Additionally, Argument Clinic must be flexible enough to work with any " "approach to argument parsing. Python has some functions with some very " "strange parsing behaviors; Argument Clinic's goal is to support all of them." msgstr "" -#: ../../howto/clinic.rst:66 +#: ../../howto/clinic.rst:67 msgid "" "Finally, the original motivation for Argument Clinic was to provide " "introspection \"signatures\" for CPython builtins. It used to be, the " @@ -104,7 +104,7 @@ msgid "" "builtin. With Argument Clinic, that's a thing of the past!" msgstr "" -#: ../../howto/clinic.rst:72 +#: ../../howto/clinic.rst:73 msgid "" "One idea you should keep in mind, as you work with Argument Clinic: the more " "information you give it, the better job it'll be able to do. Argument Clinic " @@ -113,36 +113,36 @@ msgid "" "things with all the information you give it." msgstr "" -#: ../../howto/clinic.rst:82 -msgid "Basic Concepts And Usage" +#: ../../howto/clinic.rst:83 +msgid "Basic concepts and usage" msgstr "" -#: ../../howto/clinic.rst:84 +#: ../../howto/clinic.rst:85 msgid "" "Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic." "py``. If you run that script, specifying a C file as an argument:" msgstr "" -#: ../../howto/clinic.rst:91 +#: ../../howto/clinic.rst:92 msgid "" "Argument Clinic will scan over the file looking for lines that look exactly " "like this:" msgstr "" -#: ../../howto/clinic.rst:98 +#: ../../howto/clinic.rst:99 msgid "" "When it finds one, it reads everything up to a line that looks exactly like " "this:" msgstr "" -#: ../../howto/clinic.rst:105 +#: ../../howto/clinic.rst:106 msgid "" "Everything in between these two lines is input for Argument Clinic. All of " "these lines, including the beginning and ending comment lines, are " "collectively called an Argument Clinic \"block\"." msgstr "" -#: ../../howto/clinic.rst:109 +#: ../../howto/clinic.rst:110 msgid "" "When Argument Clinic parses one of these blocks, it generates output. This " "output is rewritten into the C file immediately after the block, followed by " @@ -150,7 +150,7 @@ msgid "" "this:" msgstr "" -#: ../../howto/clinic.rst:122 +#: ../../howto/clinic.rst:123 msgid "" "If you run Argument Clinic on the same file a second time, Argument Clinic " "will discard the old output and write out the new output with a fresh " @@ -158,7 +158,7 @@ msgid "" "change either." msgstr "" -#: ../../howto/clinic.rst:126 +#: ../../howto/clinic.rst:127 msgid "" "You should never modify the output portion of an Argument Clinic block. " "Instead, change the input until it produces the output you want. (That's " @@ -167,38 +167,38 @@ msgid "" "output.)" msgstr "" -#: ../../howto/clinic.rst:131 +#: ../../howto/clinic.rst:132 msgid "" "For the sake of clarity, here's the terminology we'll use with Argument " "Clinic:" msgstr "" -#: ../../howto/clinic.rst:133 +#: ../../howto/clinic.rst:134 msgid "" "The first line of the comment (``/*[clinic input]``) is the *start line*." msgstr "" -#: ../../howto/clinic.rst:134 +#: ../../howto/clinic.rst:135 msgid "" "The last line of the initial comment (``[clinic start generated code]*/``) " "is the *end line*." msgstr "" -#: ../../howto/clinic.rst:135 +#: ../../howto/clinic.rst:136 msgid "" "The last line (``/*[clinic end generated code: checksum=...]*/``) is the " "*checksum line*." msgstr "" -#: ../../howto/clinic.rst:136 +#: ../../howto/clinic.rst:137 msgid "In between the start line and the end line is the *input*." msgstr "" -#: ../../howto/clinic.rst:137 +#: ../../howto/clinic.rst:138 msgid "In between the end line and the checksum line is the *output*." msgstr "" -#: ../../howto/clinic.rst:138 +#: ../../howto/clinic.rst:139 msgid "" "All the text collectively, from the start line to the checksum line " "inclusively, is the *block*. (A block that hasn't been successfully " @@ -206,11 +206,11 @@ msgid "" "it's still considered a block.)" msgstr "" -#: ../../howto/clinic.rst:145 -msgid "Converting Your First Function" +#: ../../howto/clinic.rst:146 +msgid "Converting your first function" msgstr "" -#: ../../howto/clinic.rst:147 +#: ../../howto/clinic.rst:148 msgid "" "The best way to get a sense of how Argument Clinic works is to convert a " "function to work with it. Here, then, are the bare minimum steps you'd need " @@ -221,30 +221,30 @@ msgid "" "keep it simple for this walkthrough so you can learn." msgstr "" -#: ../../howto/clinic.rst:156 +#: ../../howto/clinic.rst:157 msgid "Let's dive in!" msgstr "" -#: ../../howto/clinic.rst:158 +#: ../../howto/clinic.rst:159 msgid "" "Make sure you're working with a freshly updated checkout of the CPython " "trunk." msgstr "" -#: ../../howto/clinic.rst:161 +#: ../../howto/clinic.rst:162 msgid "" "Find a Python builtin that calls either :c:func:`PyArg_ParseTuple` or :c:" "func:`PyArg_ParseTupleAndKeywords`, and hasn't been converted to work with " "Argument Clinic yet. For my example I'm using ``_pickle.Pickler.dump()``." msgstr "" -#: ../../howto/clinic.rst:166 +#: ../../howto/clinic.rst:167 msgid "" "If the call to the ``PyArg_Parse`` function uses any of the following format " "units:" msgstr "" -#: ../../howto/clinic.rst:178 +#: ../../howto/clinic.rst:179 msgid "" "or if it has multiple calls to :c:func:`PyArg_ParseTuple`, you should choose " "a different function. Argument Clinic *does* support all of these " @@ -252,7 +252,7 @@ msgid "" "your first function." msgstr "" -#: ../../howto/clinic.rst:183 +#: ../../howto/clinic.rst:184 msgid "" "Also, if the function has multiple calls to :c:func:`PyArg_ParseTuple` or :c:" "func:`PyArg_ParseTupleAndKeywords` where it supports different types for the " @@ -262,11 +262,11 @@ msgid "" "polymorphic parameters." msgstr "" -#: ../../howto/clinic.rst:190 +#: ../../howto/clinic.rst:191 msgid "Add the following boilerplate above the function, creating our block::" msgstr "" -#: ../../howto/clinic.rst:195 +#: ../../howto/clinic.rst:196 msgid "" "Cut the docstring and paste it in between the ``[clinic]`` lines, removing " "all the junk that makes it a properly quoted C string. When you're done you " @@ -274,7 +274,7 @@ msgid "" "80 characters. (Argument Clinic will preserve indents inside the docstring.)" msgstr "" -#: ../../howto/clinic.rst:201 +#: ../../howto/clinic.rst:202 msgid "" "If the old docstring had a first line that looked like a function signature, " "throw that line away. (The docstring doesn't need it anymore—when you use " @@ -282,14 +282,14 @@ msgid "" "automatically based on the function's signature.)" msgstr "" -#: ../../howto/clinic.rst:207 ../../howto/clinic.rst:228 -#: ../../howto/clinic.rst:252 ../../howto/clinic.rst:310 -#: ../../howto/clinic.rst:350 ../../howto/clinic.rst:377 -#: ../../howto/clinic.rst:483 ../../howto/clinic.rst:535 +#: ../../howto/clinic.rst:208 ../../howto/clinic.rst:229 +#: ../../howto/clinic.rst:253 ../../howto/clinic.rst:311 +#: ../../howto/clinic.rst:351 ../../howto/clinic.rst:378 +#: ../../howto/clinic.rst:484 ../../howto/clinic.rst:536 msgid "Sample::" msgstr "" -#: ../../howto/clinic.rst:213 +#: ../../howto/clinic.rst:214 msgid "" "If your docstring doesn't have a \"summary\" line, Argument Clinic will " "complain. So let's make sure it has one. The \"summary\" line should be a " @@ -297,13 +297,13 @@ msgid "" "docstring." msgstr "" -#: ../../howto/clinic.rst:218 +#: ../../howto/clinic.rst:219 msgid "" "(Our example docstring consists solely of a summary line, so the sample code " "doesn't have to change for this step.)" msgstr "" -#: ../../howto/clinic.rst:221 +#: ../../howto/clinic.rst:222 msgid "" "Above the docstring, enter the name of the function, followed by a blank " "line. This should be the Python name of the function, and should be the " @@ -312,7 +312,7 @@ msgid "" "it should include the class name too." msgstr "" -#: ../../howto/clinic.rst:236 +#: ../../howto/clinic.rst:237 msgid "" "If this is the first time that module or class has been used with Argument " "Clinic in this C file, you must declare the module and/or class. Proper " @@ -322,47 +322,47 @@ msgid "" "next to each other.)" msgstr "" -#: ../../howto/clinic.rst:244 +#: ../../howto/clinic.rst:245 msgid "" "The name of the class and module should be the same as the one seen by " "Python. Check the name defined in the :c:type:`PyModuleDef` or :c:type:" "`PyTypeObject` as appropriate." msgstr "" -#: ../../howto/clinic.rst:248 +#: ../../howto/clinic.rst:249 msgid "" "When you declare a class, you must also specify two aspects of its type in " "C: the type declaration you'd use for a pointer to an instance of this " "class, and a pointer to the :c:type:`PyTypeObject` for this class." msgstr "" -#: ../../howto/clinic.rst:268 +#: ../../howto/clinic.rst:269 msgid "" "Declare each of the parameters to the function. Each parameter should get " "its own line. All the parameter lines should be indented from the function " "name and the docstring." msgstr "" -#: ../../howto/clinic.rst:272 +#: ../../howto/clinic.rst:273 msgid "The general form of these parameter lines is as follows:" msgstr "" -#: ../../howto/clinic.rst:278 +#: ../../howto/clinic.rst:279 msgid "If the parameter has a default value, add that after the converter:" msgstr "" -#: ../../howto/clinic.rst:285 +#: ../../howto/clinic.rst:286 msgid "" "Argument Clinic's support for \"default values\" is quite sophisticated; " "please see :ref:`the section below on default values ` for " "more information." msgstr "" -#: ../../howto/clinic.rst:289 +#: ../../howto/clinic.rst:290 msgid "Add a blank line below the parameters." msgstr "" -#: ../../howto/clinic.rst:291 +#: ../../howto/clinic.rst:292 msgid "" "What's a \"converter\"? It establishes both the type of the variable used " "in C, and the method to convert the Python value into a C value at runtime. " @@ -371,7 +371,7 @@ msgid "" "easier." msgstr "" -#: ../../howto/clinic.rst:298 +#: ../../howto/clinic.rst:299 msgid "" "For each parameter, copy the \"format unit\" for that parameter from the " "``PyArg_Parse()`` format argument and specify *that* as its converter, as a " @@ -381,58 +381,58 @@ msgid "" "For more on format units please see :ref:`arg-parsing`.)" msgstr "" -#: ../../howto/clinic.rst:307 +#: ../../howto/clinic.rst:308 msgid "" "For multicharacter format units like ``z#``, use the entire two-or-three " "character string." msgstr "" -#: ../../howto/clinic.rst:325 +#: ../../howto/clinic.rst:326 msgid "" "If your function has ``|`` in the format string, meaning some parameters " "have default values, you can ignore it. Argument Clinic infers which " "parameters are optional based on whether or not they have default values." msgstr "" -#: ../../howto/clinic.rst:330 +#: ../../howto/clinic.rst:331 msgid "" "If your function has ``$`` in the format string, meaning it takes keyword-" "only arguments, specify ``*`` on a line by itself before the first keyword-" "only argument, indented the same as the parameter lines." msgstr "" -#: ../../howto/clinic.rst:335 +#: ../../howto/clinic.rst:336 msgid "(``_pickle.Pickler.dump`` has neither, so our sample is unchanged.)" msgstr "" -#: ../../howto/clinic.rst:338 +#: ../../howto/clinic.rst:339 msgid "" "If the existing C function calls :c:func:`PyArg_ParseTuple` (as opposed to :" "c:func:`PyArg_ParseTupleAndKeywords`), then all its arguments are positional-" "only." msgstr "" -#: ../../howto/clinic.rst:342 +#: ../../howto/clinic.rst:343 msgid "" "To mark all parameters as positional-only in Argument Clinic, add a ``/`` on " "a line by itself after the last parameter, indented the same as the " "parameter lines." msgstr "" -#: ../../howto/clinic.rst:346 +#: ../../howto/clinic.rst:347 msgid "" "Currently this is all-or-nothing; either all parameters are positional-only, " "or none of them are. (In the future Argument Clinic may relax this " "restriction.)" msgstr "" -#: ../../howto/clinic.rst:366 +#: ../../howto/clinic.rst:367 msgid "" "It's helpful to write a per-parameter docstring for each parameter. But per-" "parameter docstrings are optional; you can skip this step if you prefer." msgstr "" -#: ../../howto/clinic.rst:370 +#: ../../howto/clinic.rst:371 msgid "" "Here's how to add a per-parameter docstring. The first line of the per-" "parameter docstring must be indented further than the parameter definition. " @@ -442,34 +442,34 @@ msgid "" "you wish." msgstr "" -#: ../../howto/clinic.rst:394 +#: ../../howto/clinic.rst:395 msgid "" "Save and close the file, then run ``Tools/clinic/clinic.py`` on it. With " "luck everything worked---your block now has output, and a ``.c.h`` file has " "been generated! Reopen the file in your text editor to see::" msgstr "" -#: ../../howto/clinic.rst:413 +#: ../../howto/clinic.rst:414 msgid "" "Obviously, if Argument Clinic didn't produce any output, it's because it " "found an error in your input. Keep fixing your errors and retrying until " "Argument Clinic processes your file without complaint." msgstr "" -#: ../../howto/clinic.rst:417 +#: ../../howto/clinic.rst:418 msgid "" "For readability, most of the glue code has been generated to a ``.c.h`` " "file. You'll need to include that in your original ``.c`` file, typically " "right after the clinic module block::" msgstr "" -#: ../../howto/clinic.rst:423 +#: ../../howto/clinic.rst:424 msgid "" "Double-check that the argument-parsing code Argument Clinic generated looks " "basically the same as the existing code." msgstr "" -#: ../../howto/clinic.rst:426 +#: ../../howto/clinic.rst:427 msgid "" "First, ensure both places use the same argument-parsing function. The " "existing code must call either :c:func:`PyArg_ParseTuple` or :c:func:" @@ -477,21 +477,21 @@ msgid "" "Clinic calls the *exact* same function." msgstr "" -#: ../../howto/clinic.rst:432 +#: ../../howto/clinic.rst:433 msgid "" "Second, the format string passed in to :c:func:`PyArg_ParseTuple` or :c:func:" "`PyArg_ParseTupleAndKeywords` should be *exactly* the same as the hand-" "written one in the existing function, up to the colon or semi-colon." msgstr "" -#: ../../howto/clinic.rst:437 +#: ../../howto/clinic.rst:438 msgid "" "(Argument Clinic always generates its format strings with a ``:`` followed " "by the name of the function. If the existing code's format string ends with " "``;``, to provide usage help, this change is harmless—don't worry about it.)" msgstr "" -#: ../../howto/clinic.rst:442 +#: ../../howto/clinic.rst:443 msgid "" "Third, for parameters whose format units require two arguments (like a " "length variable, or an encoding string, or a pointer to a conversion " @@ -499,27 +499,27 @@ msgid "" "two invocations." msgstr "" -#: ../../howto/clinic.rst:447 +#: ../../howto/clinic.rst:448 msgid "" "Fourth, inside the output portion of the block you'll find a preprocessor " "macro defining the appropriate static :c:type:`PyMethodDef` structure for " "this builtin::" msgstr "" -#: ../../howto/clinic.rst:454 +#: ../../howto/clinic.rst:455 msgid "" "This static structure should be *exactly* the same as the existing static :c:" "type:`PyMethodDef` structure for this builtin." msgstr "" -#: ../../howto/clinic.rst:457 +#: ../../howto/clinic.rst:458 msgid "" "If any of these items differ in *any way*, adjust your Argument Clinic " "function specification and rerun ``Tools/clinic/clinic.py`` until they *are* " "the same." msgstr "" -#: ../../howto/clinic.rst:462 +#: ../../howto/clinic.rst:463 msgid "" "Notice that the last line of its output is the declaration of your \"impl\" " "function. This is where the builtin's implementation goes. Delete the " @@ -530,20 +530,20 @@ msgid "" "used different names for these variables, fix it." msgstr "" -#: ../../howto/clinic.rst:470 +#: ../../howto/clinic.rst:471 msgid "" "Let's reiterate, just because it's kind of weird. Your code should now look " "like this::" msgstr "" -#: ../../howto/clinic.rst:479 +#: ../../howto/clinic.rst:480 msgid "" "Argument Clinic generated the checksum line and the function prototype just " "above it. You should write the opening (and closing) curly braces for the " "function, and the implementation inside." msgstr "" -#: ../../howto/clinic.rst:524 +#: ../../howto/clinic.rst:525 msgid "" "Remember the macro with the :c:type:`PyMethodDef` structure for this " "function? Find the existing :c:type:`PyMethodDef` structure for this " @@ -553,81 +553,75 @@ msgid "" "to the implementation.)" msgstr "" -#: ../../howto/clinic.rst:531 +#: ../../howto/clinic.rst:532 msgid "" "Note that the body of the macro contains a trailing comma. So when you " "replace the existing static :c:type:`PyMethodDef` structure with the macro, " "*don't* add a comma to the end." msgstr "" -#: ../../howto/clinic.rst:544 +#: ../../howto/clinic.rst:545 msgid "" "Compile, then run the relevant portions of the regression-test suite. This " "change should not introduce any new compile-time warnings or errors, and " "there should be no externally visible change to Python's behavior." msgstr "" -#: ../../howto/clinic.rst:548 +#: ../../howto/clinic.rst:549 msgid "" "Well, except for one difference: ``inspect.signature()`` run on your " "function should now provide a valid signature!" msgstr "" -#: ../../howto/clinic.rst:551 +#: ../../howto/clinic.rst:552 msgid "" "Congratulations, you've ported your first function to work with Argument " "Clinic!" msgstr "" -#: ../../howto/clinic.rst:554 -msgid "Advanced Topics" -msgstr "" - #: ../../howto/clinic.rst:556 -msgid "" -"Now that you've had some experience working with Argument Clinic, it's time " -"for some advanced topics." +msgid "How-to guides" msgstr "" -#: ../../howto/clinic.rst:561 -msgid "Symbolic default values" +#: ../../howto/clinic.rst:560 +msgid "How to use symbolic default values" msgstr "" -#: ../../howto/clinic.rst:563 +#: ../../howto/clinic.rst:562 msgid "" "The default value you provide for a parameter can't be any arbitrary " "expression. Currently the following are explicitly supported:" msgstr "" -#: ../../howto/clinic.rst:566 +#: ../../howto/clinic.rst:565 msgid "Numeric constants (integer and float)" msgstr "" -#: ../../howto/clinic.rst:567 +#: ../../howto/clinic.rst:566 msgid "String constants" msgstr "" -#: ../../howto/clinic.rst:568 +#: ../../howto/clinic.rst:567 msgid "``True``, ``False``, and ``None``" msgstr "" -#: ../../howto/clinic.rst:569 +#: ../../howto/clinic.rst:568 msgid "" "Simple symbolic constants like ``sys.maxsize``, which must start with the " "name of the module" msgstr "" -#: ../../howto/clinic.rst:572 +#: ../../howto/clinic.rst:571 msgid "" "(In the future, this may need to get even more elaborate, to allow full " "expressions like ``CONSTANT - 1``.)" msgstr "" -#: ../../howto/clinic.rst:577 -msgid "Renaming the C functions and variables generated by Argument Clinic" +#: ../../howto/clinic.rst:576 +msgid "How to to rename C functions and variables generated by Argument Clinic" msgstr "" -#: ../../howto/clinic.rst:579 +#: ../../howto/clinic.rst:578 msgid "" "Argument Clinic automatically names the functions it generates for you. " "Occasionally this may cause a problem, if the generated name collides with " @@ -639,19 +633,19 @@ msgid "" "impl function." msgstr "" -#: ../../howto/clinic.rst:587 +#: ../../howto/clinic.rst:586 msgid "" "For example, if we wanted to rename the C function names generated for " "``pickle.Pickler.dump``, it'd look like this::" msgstr "" -#: ../../howto/clinic.rst:595 +#: ../../howto/clinic.rst:594 msgid "" "The base function would now be named ``pickler_dumper()``, and the impl " "function would now be named ``pickler_dumper_impl()``." msgstr "" -#: ../../howto/clinic.rst:599 +#: ../../howto/clinic.rst:598 msgid "" "Similarly, you may have a problem where you want to give a parameter a " "specific Python name, but that name may be inconvenient in C. Argument " @@ -659,21 +653,21 @@ msgid "" "using the same ``\"as\"`` syntax::" msgstr "" -#: ../../howto/clinic.rst:613 +#: ../../howto/clinic.rst:612 msgid "" "Here, the name used in Python (in the signature and the ``keywords`` array) " "would be ``file``, but the C variable would be named ``file_obj``." msgstr "" -#: ../../howto/clinic.rst:616 +#: ../../howto/clinic.rst:615 msgid "You can use this to rename the ``self`` parameter too!" msgstr "" -#: ../../howto/clinic.rst:620 -msgid "Converting functions using PyArg_UnpackTuple" +#: ../../howto/clinic.rst:619 +msgid "How to convert functions using ``PyArg_UnpackTuple``" msgstr "" -#: ../../howto/clinic.rst:622 +#: ../../howto/clinic.rst:621 msgid "" "To convert a function parsing its arguments with :c:func:" "`PyArg_UnpackTuple`, simply write out all the arguments, specifying each as " @@ -682,14 +676,14 @@ msgid "" "a line by itself after the last argument)." msgstr "" -#: ../../howto/clinic.rst:628 +#: ../../howto/clinic.rst:627 msgid "" "Currently the generated code will use :c:func:`PyArg_ParseTuple`, but this " "will change soon." msgstr "" #: ../../howto/clinic.rst:632 -msgid "Optional Groups" +msgid "How to use optional groups" msgstr "" #: ../../howto/clinic.rst:634 @@ -787,7 +781,8 @@ msgid "" msgstr "" #: ../../howto/clinic.rst:725 -msgid "Using real Argument Clinic converters, instead of \"legacy converters\"" +msgid "" +"How to use real Argument Clinic converters, instead of \"legacy converters\"" msgstr "" #: ../../howto/clinic.rst:727 @@ -844,7 +839,7 @@ msgid "" "Clinic converters accept the following arguments:" msgstr "" -#: ../../howto/clinic.rst:763 ../../howto/clinic.rst:1328 +#: ../../howto/clinic.rst:763 ../../howto/clinic.rst:1329 msgid "``c_default``" msgstr "``c_default``" @@ -899,7 +894,7 @@ msgid "" "even for negative values." msgstr "" -#: ../../howto/clinic.rst:789 ../../howto/clinic.rst:1342 +#: ../../howto/clinic.rst:789 ../../howto/clinic.rst:1343 msgid "``converter``" msgstr "``converter``" @@ -930,7 +925,7 @@ msgid "" "be a subclass of a Python type, as expressed in C." msgstr "" -#: ../../howto/clinic.rst:803 ../../howto/clinic.rst:1314 +#: ../../howto/clinic.rst:803 ../../howto/clinic.rst:1315 msgid "``type``" msgstr "``type``" @@ -1324,11 +1319,11 @@ msgid "" "converters`` to see the full list." msgstr "" -#: ../../howto/clinic.rst:892 -msgid "Py_buffer" -msgstr "Py_buffer" +#: ../../howto/clinic.rst:893 +msgid "How to use the ``Py_buffer`` converter" +msgstr "" -#: ../../howto/clinic.rst:894 +#: ../../howto/clinic.rst:895 msgid "" "When using the ``Py_buffer`` converter (or the ``'s*'``, ``'w*'``, ``'*y'``, " "or ``'z*'`` legacy converters), you *must* not call :c:func:" @@ -1337,7 +1332,7 @@ msgid "" msgstr "" #: ../../howto/clinic.rst:902 -msgid "Advanced converters" +msgid "How to use advanced converters" msgstr "" #: ../../howto/clinic.rst:904 @@ -1380,7 +1375,7 @@ msgid "" msgstr "" #: ../../howto/clinic.rst:934 -msgid "Parameter default values" +msgid "How to assign default values to parameter" msgstr "" #: ../../howto/clinic.rst:936 @@ -1400,7 +1395,7 @@ msgid "" msgstr "" #: ../../howto/clinic.rst:958 -msgid "The ``NULL`` default value" +msgid "How to use the ``NULL`` default value" msgstr "" #: ../../howto/clinic.rst:960 @@ -1413,11 +1408,11 @@ msgid "" "with ``NULL``." msgstr "" -#: ../../howto/clinic.rst:968 -msgid "Expressions specified as default values" +#: ../../howto/clinic.rst:969 +msgid "How to use expressions as default values" msgstr "" -#: ../../howto/clinic.rst:970 +#: ../../howto/clinic.rst:971 msgid "" "The default value for a parameter can be more than just a literal value. It " "can be an entire expression, using math operators and looking up attributes " @@ -1425,11 +1420,11 @@ msgid "" "obvious semantics." msgstr "" -#: ../../howto/clinic.rst:975 +#: ../../howto/clinic.rst:976 msgid "Consider the following example:" msgstr "" -#: ../../howto/clinic.rst:981 +#: ../../howto/clinic.rst:982 msgid "" "``sys.maxsize`` can have different values on different platforms. Therefore " "Argument Clinic can't simply evaluate that expression locally and hard-code " @@ -1437,14 +1432,14 @@ msgid "" "at runtime, when the user asks for the function's signature." msgstr "" -#: ../../howto/clinic.rst:986 +#: ../../howto/clinic.rst:987 msgid "" "What namespace is available when the expression is evaluated? It's " "evaluated in the context of the module the builtin came from. So, if your " "module has an attribute called \"``max_widgets``\", you may simply use it:" msgstr "" -#: ../../howto/clinic.rst:994 +#: ../../howto/clinic.rst:995 msgid "" "If the symbol isn't found in the current module, it fails over to looking in " "``sys.modules``. That's how it can find ``sys.maxsize`` for example. " @@ -1453,7 +1448,7 @@ msgid "" "Python itself.)" msgstr "" -#: ../../howto/clinic.rst:999 +#: ../../howto/clinic.rst:1000 msgid "" "Evaluating default values only at runtime means Argument Clinic can't " "compute the correct equivalent C default value. So you need to tell it " @@ -1461,7 +1456,7 @@ msgid "" "expression in C, using the ``c_default`` parameter to the converter:" msgstr "" -#: ../../howto/clinic.rst:1008 +#: ../../howto/clinic.rst:1009 msgid "" "Another complication: Argument Clinic can't know in advance whether or not " "the expression you supply is valid. It parses it to make sure it looks " @@ -1469,35 +1464,35 @@ msgid "" "expressions to specify values that are guaranteed to be valid at runtime!" msgstr "" -#: ../../howto/clinic.rst:1013 +#: ../../howto/clinic.rst:1014 msgid "" "Finally, because expressions must be representable as static C values, there " "are many restrictions on legal expressions. Here's a list of Python " "features you're not permitted to use:" msgstr "" -#: ../../howto/clinic.rst:1017 +#: ../../howto/clinic.rst:1018 msgid "Function calls." msgstr "" -#: ../../howto/clinic.rst:1018 +#: ../../howto/clinic.rst:1019 msgid "Inline if statements (``3 if foo else 5``)." msgstr "" -#: ../../howto/clinic.rst:1019 +#: ../../howto/clinic.rst:1020 msgid "Automatic sequence unpacking (``*[1, 2, 3]``)." msgstr "" -#: ../../howto/clinic.rst:1020 +#: ../../howto/clinic.rst:1021 msgid "List/set/dict comprehensions and generator expressions." msgstr "" -#: ../../howto/clinic.rst:1021 +#: ../../howto/clinic.rst:1022 msgid "Tuple/list/set/dict literals." msgstr "" #: ../../howto/clinic.rst:1026 -msgid "Using a return converter" +msgid "How to use return converters" msgstr "" #: ../../howto/clinic.rst:1028 @@ -1580,7 +1575,7 @@ msgid "" msgstr "" #: ../../howto/clinic.rst:1101 -msgid "Cloning existing functions" +msgid "How to clone existing functions" msgstr "" #: ../../howto/clinic.rst:1103 @@ -1648,41 +1643,41 @@ msgid "" "the current file." msgstr "" -#: ../../howto/clinic.rst:1144 -msgid "Calling Python code" +#: ../../howto/clinic.rst:1145 +msgid "How to call Python code" msgstr "" -#: ../../howto/clinic.rst:1146 +#: ../../howto/clinic.rst:1147 msgid "" "The rest of the advanced topics require you to write Python code which lives " "inside your C file and modifies Argument Clinic's runtime state. This is " "simple: you simply define a Python block." msgstr "" -#: ../../howto/clinic.rst:1150 +#: ../../howto/clinic.rst:1151 msgid "" "A Python block uses different delimiter lines than an Argument Clinic " "function block. It looks like this::" msgstr "" -#: ../../howto/clinic.rst:1157 +#: ../../howto/clinic.rst:1158 msgid "" "All the code inside the Python block is executed at the time it's parsed. " "All text written to stdout inside the block is redirected into the " "\"output\" after the block." msgstr "" -#: ../../howto/clinic.rst:1161 +#: ../../howto/clinic.rst:1162 msgid "" "As an example, here's a Python block that adds a static integer variable to " "the C code::" msgstr "" -#: ../../howto/clinic.rst:1172 -msgid "Using a \"self converter\"" +#: ../../howto/clinic.rst:1173 +msgid "How to use the \"self converter\"" msgstr "" -#: ../../howto/clinic.rst:1174 +#: ../../howto/clinic.rst:1175 msgid "" "Argument Clinic automatically adds a \"self\" parameter for you using a " "default converter. It automatically sets the ``type`` of this parameter to " @@ -1693,13 +1688,13 @@ msgid "" "a subclass thereof." msgstr "" -#: ../../howto/clinic.rst:1183 +#: ../../howto/clinic.rst:1184 msgid "" "What's the point? This lets you override the type of ``self``, or give it a " "different default name." msgstr "" -#: ../../howto/clinic.rst:1186 +#: ../../howto/clinic.rst:1187 msgid "" "How do you specify the custom type you want to cast ``self`` to? If you only " "have one or two functions with the same type for ``self``, you can directly " @@ -1707,18 +1702,18 @@ msgid "" "want to use as the ``type`` parameter::" msgstr "" -#: ../../howto/clinic.rst:1202 +#: ../../howto/clinic.rst:1203 msgid "" "On the other hand, if you have a lot of functions that will use the same " "type for ``self``, it's best to create your own converter, subclassing " "``self_converter`` but overwriting the ``type`` member::" msgstr "" -#: ../../howto/clinic.rst:1224 -msgid "Using a \"defining class\" converter" +#: ../../howto/clinic.rst:1225 +msgid "How to use the \"defining class\" converter" msgstr "" -#: ../../howto/clinic.rst:1226 +#: ../../howto/clinic.rst:1227 msgid "" "Argument Clinic facilitates gaining access to the defining class of a " "method. This is useful for :ref:`heap type ` methods that need " @@ -1728,25 +1723,25 @@ msgid "" "example from a module method." msgstr "" -#: ../../howto/clinic.rst:1232 +#: ../../howto/clinic.rst:1233 msgid "" "Example from ``Modules/zlibmodule.c``. First, ``defining_class`` is added " "to the clinic input::" msgstr "" -#: ../../howto/clinic.rst:1244 +#: ../../howto/clinic.rst:1245 msgid "" "After running the Argument Clinic tool, the following function signature is " "generated::" msgstr "" -#: ../../howto/clinic.rst:1254 +#: ../../howto/clinic.rst:1255 msgid "" "The following code can now use ``PyType_GetModuleState(cls)`` to fetch the " "module state::" msgstr "" -#: ../../howto/clinic.rst:1260 +#: ../../howto/clinic.rst:1261 msgid "" "Each method may only have one argument using this converter, and it must " "appear after ``self``, or, if ``self`` is not used, as the first argument. " @@ -1754,13 +1749,13 @@ msgid "" "appear in the ``__text_signature__``." msgstr "" -#: ../../howto/clinic.rst:1265 +#: ../../howto/clinic.rst:1266 msgid "" "The ``defining_class`` converter is not compatible with ``__init__`` and " "``__new__`` methods, which cannot use the ``METH_METHOD`` convention." msgstr "" -#: ../../howto/clinic.rst:1268 +#: ../../howto/clinic.rst:1269 msgid "" "It is not possible to use ``defining_class`` with slot methods. In order to " "fetch the module state from such methods, use :c:func:" @@ -1769,15 +1764,15 @@ msgid "" "``setattro`` slot method in ``Modules/_threadmodule.c``::" msgstr "" -#: ../../howto/clinic.rst:1283 +#: ../../howto/clinic.rst:1284 msgid "See also :pep:`573`." msgstr "也請見 :pep:`573`\\ 。" -#: ../../howto/clinic.rst:1287 -msgid "Writing a custom converter" +#: ../../howto/clinic.rst:1288 +msgid "How to write a custom converter" msgstr "" -#: ../../howto/clinic.rst:1289 +#: ../../howto/clinic.rst:1290 msgid "" "As we hinted at in the previous section... you can write your own " "converters! A converter is simply a Python class that inherits from " @@ -1786,7 +1781,7 @@ msgid "" "a :c:func:`PyArg_ParseTuple` \"converter function\"." msgstr "" -#: ../../howto/clinic.rst:1295 +#: ../../howto/clinic.rst:1296 msgid "" "Your converter class should be named ``*something*_converter``. If the name " "follows this convention, then your converter class will be automatically " @@ -1795,7 +1790,7 @@ msgid "" "metaclass.)" msgstr "" -#: ../../howto/clinic.rst:1301 +#: ../../howto/clinic.rst:1302 msgid "" "You shouldn't subclass ``CConverter.__init__``. Instead, you should write a " "``converter_init()`` function. ``converter_init()`` always accepts a " @@ -1804,50 +1799,50 @@ msgid "" "passed along to your ``converter_init()``." msgstr "" -#: ../../howto/clinic.rst:1308 +#: ../../howto/clinic.rst:1309 msgid "" "There are some additional members of ``CConverter`` you may wish to specify " "in your subclass. Here's the current list:" msgstr "" -#: ../../howto/clinic.rst:1312 +#: ../../howto/clinic.rst:1313 msgid "" "The C type to use for this variable. ``type`` should be a Python string " "specifying the type, e.g. ``int``. If this is a pointer type, the type " "string should end with ``' *'``." msgstr "" -#: ../../howto/clinic.rst:1318 +#: ../../howto/clinic.rst:1319 msgid "``default``" msgstr "``default``" -#: ../../howto/clinic.rst:1317 +#: ../../howto/clinic.rst:1318 msgid "" "The Python default value for this parameter, as a Python value. Or the magic " "value ``unspecified`` if there is no default." msgstr "" -#: ../../howto/clinic.rst:1323 +#: ../../howto/clinic.rst:1324 msgid "``py_default``" msgstr "``py_default``" -#: ../../howto/clinic.rst:1321 +#: ../../howto/clinic.rst:1322 msgid "" "``default`` as it should appear in Python code, as a string. Or ``None`` if " "there is no default." msgstr "" -#: ../../howto/clinic.rst:1326 +#: ../../howto/clinic.rst:1327 msgid "" "``default`` as it should appear in C code, as a string. Or ``None`` if there " "is no default." msgstr "" -#: ../../howto/clinic.rst:1339 +#: ../../howto/clinic.rst:1340 msgid "``c_ignored_default``" msgstr "``c_ignored_default``" -#: ../../howto/clinic.rst:1331 +#: ../../howto/clinic.rst:1332 msgid "" "The default value used to initialize the C variable when there is no " "default, but not specifying a default may result in an \"uninitialized " @@ -1858,37 +1853,37 @@ msgid "" "non-empty string." msgstr "" -#: ../../howto/clinic.rst:1342 +#: ../../howto/clinic.rst:1343 msgid "The name of the C converter function, as a string." msgstr "" -#: ../../howto/clinic.rst:1347 +#: ../../howto/clinic.rst:1348 msgid "``impl_by_reference``" msgstr "``impl_by_reference``" -#: ../../howto/clinic.rst:1345 +#: ../../howto/clinic.rst:1346 msgid "" "A boolean value. If true, Argument Clinic will add a ``&`` in front of the " "name of the variable when passing it into the impl function." msgstr "" -#: ../../howto/clinic.rst:1353 +#: ../../howto/clinic.rst:1354 msgid "``parse_by_reference``" msgstr "``parse_by_reference``" -#: ../../howto/clinic.rst:1350 +#: ../../howto/clinic.rst:1351 msgid "" "A boolean value. If true, Argument Clinic will add a ``&`` in front of the " "name of the variable when passing it into :c:func:`PyArg_ParseTuple`." msgstr "" -#: ../../howto/clinic.rst:1355 +#: ../../howto/clinic.rst:1356 msgid "" "Here's the simplest example of a custom converter, from ``Modules/zlibmodule." "c``::" msgstr "" -#: ../../howto/clinic.rst:1366 +#: ../../howto/clinic.rst:1367 msgid "" "This block adds a converter to Argument Clinic named ``ssize_t``. " "Parameters declared as ``ssize_t`` will be declared as type :c:type:" @@ -1897,25 +1892,25 @@ msgid "" "automatically support default values." msgstr "" -#: ../../howto/clinic.rst:1372 +#: ../../howto/clinic.rst:1373 msgid "" "More sophisticated custom converters can insert custom C code to handle " "initialization and cleanup. You can see more examples of custom converters " "in the CPython source tree; grep the C files for the string ``CConverter``." msgstr "" -#: ../../howto/clinic.rst:1378 -msgid "Writing a custom return converter" +#: ../../howto/clinic.rst:1380 +msgid "How to write a custom return converter" msgstr "" -#: ../../howto/clinic.rst:1380 +#: ../../howto/clinic.rst:1382 msgid "" "Writing a custom return converter is much like writing a custom converter. " "Except it's somewhat simpler, because return converters are themselves much " "simpler." msgstr "" -#: ../../howto/clinic.rst:1384 +#: ../../howto/clinic.rst:1386 msgid "" "Return converters must subclass ``CReturnConverter``. There are no examples " "yet of custom return converters, because they are not widely used yet. If " @@ -1924,59 +1919,59 @@ msgid "" "its subclasses." msgstr "" -#: ../../howto/clinic.rst:1392 -msgid "METH_O and METH_NOARGS" +#: ../../howto/clinic.rst:1395 +msgid "How to convert ``METH_O`` and ``METH_NOARGS`` functions" msgstr "" -#: ../../howto/clinic.rst:1394 +#: ../../howto/clinic.rst:1397 msgid "" "To convert a function using ``METH_O``, make sure the function's single " "argument is using the ``object`` converter, and mark the arguments as " "positional-only::" msgstr "" -#: ../../howto/clinic.rst:1406 +#: ../../howto/clinic.rst:1409 msgid "" "To convert a function using ``METH_NOARGS``, just don't specify any " "arguments." msgstr "" -#: ../../howto/clinic.rst:1409 +#: ../../howto/clinic.rst:1412 msgid "" "You can still use a self converter, a return converter, and specify a " "``type`` argument to the object converter for ``METH_O``." msgstr "" -#: ../../howto/clinic.rst:1413 -msgid "tp_new and tp_init functions" +#: ../../howto/clinic.rst:1417 +msgid "How to convert ``tp_new`` and ``tp_init`` functions" msgstr "" -#: ../../howto/clinic.rst:1415 +#: ../../howto/clinic.rst:1419 msgid "" "You can convert ``tp_new`` and ``tp_init`` functions. Just name them " "``__new__`` or ``__init__`` as appropriate. Notes:" msgstr "" -#: ../../howto/clinic.rst:1418 +#: ../../howto/clinic.rst:1422 msgid "" "The function name generated for ``__new__`` doesn't end in ``__new__`` like " "it would by default. It's just the name of the class, converted into a " "valid C identifier." msgstr "" -#: ../../howto/clinic.rst:1422 +#: ../../howto/clinic.rst:1426 msgid "No ``PyMethodDef`` ``#define`` is generated for these functions." msgstr "" -#: ../../howto/clinic.rst:1424 +#: ../../howto/clinic.rst:1428 msgid "``__init__`` functions return ``int``, not ``PyObject *``." msgstr "" -#: ../../howto/clinic.rst:1426 +#: ../../howto/clinic.rst:1430 msgid "Use the docstring as the class docstring." msgstr "" -#: ../../howto/clinic.rst:1428 +#: ../../howto/clinic.rst:1432 msgid "" "Although ``__new__`` and ``__init__`` functions must always accept both the " "``args`` and ``kwargs`` objects, when converting you may specify any " @@ -1985,11 +1980,11 @@ msgid "" "it receives any.)" msgstr "" -#: ../../howto/clinic.rst:1435 -msgid "Changing and redirecting Clinic's output" +#: ../../howto/clinic.rst:1440 +msgid "How to change and redirect Clinic's output" msgstr "" -#: ../../howto/clinic.rst:1437 +#: ../../howto/clinic.rst:1442 msgid "" "It can be inconvenient to have Clinic's output interspersed with your " "conventional hand-edited C code. Luckily, Clinic is configurable: you can " @@ -1998,7 +1993,7 @@ msgid "" "Clinic's generated output." msgstr "" -#: ../../howto/clinic.rst:1443 +#: ../../howto/clinic.rst:1448 msgid "" "While changing Clinic's output in this manner can be a boon to readability, " "it may result in Clinic code using types before they are defined, or your " @@ -2010,15 +2005,15 @@ msgid "" "rearranging your code to fix definition-before-use problems.)" msgstr "" -#: ../../howto/clinic.rst:1452 +#: ../../howto/clinic.rst:1457 msgid "Let's start with defining some terminology:" msgstr "" -#: ../../howto/clinic.rst:1479 +#: ../../howto/clinic.rst:1484 msgid "*field*" msgstr "" -#: ../../howto/clinic.rst:1455 +#: ../../howto/clinic.rst:1460 msgid "" "A field, in this context, is a subsection of Clinic's output. For example, " "the ``#define`` for the ``PyMethodDef`` structure is a field, called " @@ -2026,7 +2021,7 @@ msgid "" "function definition:" msgstr "" -#: ../../howto/clinic.rst:1470 +#: ../../howto/clinic.rst:1475 msgid "" "All the names are of the form ``\"_\"``, where ``\"\"`` is the " "semantic object represented (the parsing function, the impl function, the " @@ -2039,45 +2034,45 @@ msgid "" "``\"_define\"``, representing that it's a preprocessor #define.)" msgstr "" -#: ../../howto/clinic.rst:1513 +#: ../../howto/clinic.rst:1518 msgid "*destination*" msgstr "" -#: ../../howto/clinic.rst:1482 +#: ../../howto/clinic.rst:1487 msgid "" "A destination is a place Clinic can write output to. There are five built-" "in destinations:" msgstr "" -#: ../../howto/clinic.rst:1487 ../../howto/clinic.rst:1562 -#: ../../howto/clinic.rst:1640 +#: ../../howto/clinic.rst:1492 ../../howto/clinic.rst:1567 +#: ../../howto/clinic.rst:1645 msgid "``block``" msgstr "``block``" -#: ../../howto/clinic.rst:1486 +#: ../../howto/clinic.rst:1491 msgid "" "The default destination: printed in the output section of the current Clinic " "block." msgstr "" -#: ../../howto/clinic.rst:1493 ../../howto/clinic.rst:1589 -#: ../../howto/clinic.rst:1643 +#: ../../howto/clinic.rst:1498 ../../howto/clinic.rst:1594 +#: ../../howto/clinic.rst:1648 msgid "``buffer``" msgstr "``buffer``" -#: ../../howto/clinic.rst:1490 +#: ../../howto/clinic.rst:1495 msgid "" "A text buffer where you can save text for later. Text sent here is appended " "to the end of any existing text. It's an error to have any text left in the " "buffer when Clinic finishes processing a file." msgstr "" -#: ../../howto/clinic.rst:1504 ../../howto/clinic.rst:1575 -#: ../../howto/clinic.rst:1669 +#: ../../howto/clinic.rst:1509 ../../howto/clinic.rst:1580 +#: ../../howto/clinic.rst:1674 msgid "``file``" msgstr "``file``" -#: ../../howto/clinic.rst:1496 +#: ../../howto/clinic.rst:1501 msgid "" "A separate \"clinic file\" that will be created automatically by Clinic. The " "filename chosen for the file is ``{basename}.clinic{extension}``, where " @@ -2086,65 +2081,65 @@ msgid "" "for ``_pickle.c`` would be written to ``_pickle.clinic.c``.)" msgstr "" -#: ../../howto/clinic.rst:1503 +#: ../../howto/clinic.rst:1508 msgid "" "**Important: When using a** ``file`` **destination, you** *must check in* " "**the generated file!**" msgstr "" -#: ../../howto/clinic.rst:1509 ../../howto/clinic.rst:1602 -#: ../../howto/clinic.rst:1673 +#: ../../howto/clinic.rst:1514 ../../howto/clinic.rst:1607 +#: ../../howto/clinic.rst:1678 msgid "``two-pass``" msgstr "``two-pass``" -#: ../../howto/clinic.rst:1507 +#: ../../howto/clinic.rst:1512 msgid "" "A buffer like ``buffer``. However, a two-pass buffer can only be dumped " "once, and it prints out all text sent to it during all processing, even from " "Clinic blocks *after* the dumping point." msgstr "" -#: ../../howto/clinic.rst:1513 ../../howto/clinic.rst:1636 +#: ../../howto/clinic.rst:1518 ../../howto/clinic.rst:1641 msgid "``suppress``" msgstr "``suppress``" -#: ../../howto/clinic.rst:1512 +#: ../../howto/clinic.rst:1517 msgid "The text is suppressed—thrown away." msgstr "" -#: ../../howto/clinic.rst:1515 +#: ../../howto/clinic.rst:1520 msgid "Clinic defines five new directives that let you reconfigure its output." msgstr "" -#: ../../howto/clinic.rst:1517 +#: ../../howto/clinic.rst:1522 msgid "The first new directive is ``dump``:" msgstr "" -#: ../../howto/clinic.rst:1523 +#: ../../howto/clinic.rst:1528 msgid "" "This dumps the current contents of the named destination into the output of " "the current block, and empties it. This only works with ``buffer`` and " "``two-pass`` destinations." msgstr "" -#: ../../howto/clinic.rst:1527 +#: ../../howto/clinic.rst:1532 msgid "" "The second new directive is ``output``. The most basic form of ``output`` " "is like this:" msgstr "" -#: ../../howto/clinic.rst:1534 +#: ../../howto/clinic.rst:1539 msgid "" "This tells Clinic to output *field* to *destination*. ``output`` also " "supports a special meta-destination, called ``everything``, which tells " "Clinic to output *all* fields to that *destination*." msgstr "" -#: ../../howto/clinic.rst:1538 +#: ../../howto/clinic.rst:1543 msgid "``output`` has a number of other functions:" msgstr "" -#: ../../howto/clinic.rst:1547 +#: ../../howto/clinic.rst:1552 msgid "" "``output push`` and ``output pop`` allow you to push and pop configurations " "on an internal configuration stack, so that you can temporarily modify the " @@ -2153,25 +2148,25 @@ msgid "" "when you wish to restore the previous configuration." msgstr "" -#: ../../howto/clinic.rst:1554 +#: ../../howto/clinic.rst:1559 msgid "" "``output preset`` sets Clinic's output to one of several built-in preset " "configurations, as follows:" msgstr "" -#: ../../howto/clinic.rst:1558 +#: ../../howto/clinic.rst:1563 msgid "" "Clinic's original starting configuration. Writes everything immediately " "after the input block." msgstr "" -#: ../../howto/clinic.rst:1561 +#: ../../howto/clinic.rst:1566 msgid "" "Suppress the ``parser_prototype`` and ``docstring_prototype``, write " "everything else to ``block``." msgstr "" -#: ../../howto/clinic.rst:1565 +#: ../../howto/clinic.rst:1570 msgid "" "Designed to write everything to the \"clinic file\" that it can. You then " "``#include`` this file near the top of your file. You may need to rearrange " @@ -2179,17 +2174,17 @@ msgid "" "declarations for various ``typedef`` and ``PyTypeObject`` definitions." msgstr "" -#: ../../howto/clinic.rst:1571 +#: ../../howto/clinic.rst:1576 msgid "" "Suppress the ``parser_prototype`` and ``docstring_prototype``, write the " "``impl_definition`` to ``block``, and write everything else to ``file``." msgstr "" -#: ../../howto/clinic.rst:1575 +#: ../../howto/clinic.rst:1580 msgid "The default filename is ``\"{dirname}/clinic/{basename}.h\"``." msgstr "" -#: ../../howto/clinic.rst:1578 +#: ../../howto/clinic.rst:1583 msgid "" "Save up most of the output from Clinic, to be written into your file near " "the end. For Python files implementing modules or builtin types, it's " @@ -2199,14 +2194,14 @@ msgid "" "static ``PyMethodDef`` arrays defined in the middle of the file." msgstr "" -#: ../../howto/clinic.rst:1587 +#: ../../howto/clinic.rst:1592 msgid "" "Suppress the ``parser_prototype``, ``impl_prototype``, and " "``docstring_prototype``, write the ``impl_definition`` to ``block``, and " "write everything else to ``file``." msgstr "" -#: ../../howto/clinic.rst:1592 +#: ../../howto/clinic.rst:1597 msgid "" "Similar to the ``buffer`` preset, but writes forward declarations to the " "``two-pass`` buffer, and definitions to the ``buffer``. This is similar to " @@ -2215,18 +2210,18 @@ msgid "" "near the end just like you would when using the ``buffer`` preset." msgstr "" -#: ../../howto/clinic.rst:1599 +#: ../../howto/clinic.rst:1604 msgid "" "Suppresses the ``impl_prototype``, write the ``impl_definition`` to " "``block``, write ``docstring_prototype``, ``methoddef_define``, and " "``parser_prototype`` to ``two-pass``, write everything else to ``buffer``." msgstr "" -#: ../../howto/clinic.rst:1613 +#: ../../howto/clinic.rst:1618 msgid "``partial-buffer``" msgstr "``partial-buffer``" -#: ../../howto/clinic.rst:1605 +#: ../../howto/clinic.rst:1610 msgid "" "Similar to the ``buffer`` preset, but writes more things to ``block``, only " "writing the really big chunks of generated code to ``buffer``. This avoids " @@ -2236,137 +2231,137 @@ msgid "" "preset." msgstr "" -#: ../../howto/clinic.rst:1612 +#: ../../howto/clinic.rst:1617 msgid "" "Suppresses the ``impl_prototype``, write the ``docstring_definition`` and " "``parser_definition`` to ``buffer``, write everything else to ``block``." msgstr "" -#: ../../howto/clinic.rst:1615 +#: ../../howto/clinic.rst:1620 msgid "The third new directive is ``destination``:" msgstr "" -#: ../../howto/clinic.rst:1621 +#: ../../howto/clinic.rst:1626 msgid "This performs an operation on the destination named ``name``." msgstr "" -#: ../../howto/clinic.rst:1623 +#: ../../howto/clinic.rst:1628 msgid "There are two defined subcommands: ``new`` and ``clear``." msgstr "" -#: ../../howto/clinic.rst:1625 +#: ../../howto/clinic.rst:1630 msgid "The ``new`` subcommand works like this:" msgstr "" -#: ../../howto/clinic.rst:1631 +#: ../../howto/clinic.rst:1636 msgid "" "This creates a new destination with name ```` and type ````." msgstr "" -#: ../../howto/clinic.rst:1633 +#: ../../howto/clinic.rst:1638 msgid "There are five destination types:" msgstr "" -#: ../../howto/clinic.rst:1636 +#: ../../howto/clinic.rst:1641 msgid "Throws the text away." msgstr "" -#: ../../howto/clinic.rst:1639 +#: ../../howto/clinic.rst:1644 msgid "" "Writes the text to the current block. This is what Clinic originally did." msgstr "" -#: ../../howto/clinic.rst:1643 +#: ../../howto/clinic.rst:1648 msgid "A simple text buffer, like the \"buffer\" builtin destination above." msgstr "" -#: ../../howto/clinic.rst:1646 +#: ../../howto/clinic.rst:1651 msgid "" "A text file. The file destination takes an extra argument, a template to " "use for building the filename, like so:" msgstr "" -#: ../../howto/clinic.rst:1649 +#: ../../howto/clinic.rst:1654 msgid "destination new " msgstr "" -#: ../../howto/clinic.rst:1651 +#: ../../howto/clinic.rst:1656 msgid "" "The template can use three strings internally that will be replaced by bits " "of the filename:" msgstr "" -#: ../../howto/clinic.rst:1654 +#: ../../howto/clinic.rst:1659 msgid "{path}" msgstr "{path}" -#: ../../howto/clinic.rst:1655 +#: ../../howto/clinic.rst:1660 msgid "The full path to the file, including directory and full filename." msgstr "" -#: ../../howto/clinic.rst:1656 +#: ../../howto/clinic.rst:1661 msgid "{dirname}" msgstr "{dirname}" -#: ../../howto/clinic.rst:1657 +#: ../../howto/clinic.rst:1662 msgid "The name of the directory the file is in." msgstr "" -#: ../../howto/clinic.rst:1658 +#: ../../howto/clinic.rst:1663 msgid "{basename}" msgstr "{basename}" -#: ../../howto/clinic.rst:1659 +#: ../../howto/clinic.rst:1664 msgid "Just the name of the file, not including the directory." msgstr "" -#: ../../howto/clinic.rst:1661 +#: ../../howto/clinic.rst:1666 msgid "{basename_root}" msgstr "{basename_root}" -#: ../../howto/clinic.rst:1661 +#: ../../howto/clinic.rst:1666 msgid "" "Basename with the extension clipped off (everything up to but not including " "the last '.')." msgstr "" -#: ../../howto/clinic.rst:1665 +#: ../../howto/clinic.rst:1670 msgid "{basename_extension}" msgstr "{basename_extension}" -#: ../../howto/clinic.rst:1664 +#: ../../howto/clinic.rst:1669 msgid "" "The last '.' and everything after it. If the basename does not contain a " "period, this will be the empty string." msgstr "" -#: ../../howto/clinic.rst:1667 +#: ../../howto/clinic.rst:1672 msgid "" "If there are no periods in the filename, {basename} and {filename} are the " "same, and {extension} is empty. \"{basename}{extension}\" is always exactly " "the same as \"{filename}\".\"" msgstr "" -#: ../../howto/clinic.rst:1672 +#: ../../howto/clinic.rst:1677 msgid "A two-pass buffer, like the \"two-pass\" builtin destination above." msgstr "" -#: ../../howto/clinic.rst:1675 +#: ../../howto/clinic.rst:1680 msgid "The ``clear`` subcommand works like this:" msgstr "" -#: ../../howto/clinic.rst:1681 +#: ../../howto/clinic.rst:1686 msgid "" "It removes all the accumulated text up to this point in the destination. (I " "don't know what you'd need this for, but I thought maybe it'd be useful " "while someone's experimenting.)" msgstr "" -#: ../../howto/clinic.rst:1685 +#: ../../howto/clinic.rst:1690 msgid "The fourth new directive is ``set``:" msgstr "" -#: ../../howto/clinic.rst:1692 +#: ../../howto/clinic.rst:1697 msgid "" "``set`` lets you set two internal variables in Clinic. ``line_prefix`` is a " "string that will be prepended to every line of Clinic's output; " @@ -2374,35 +2369,35 @@ msgid "" "output." msgstr "" -#: ../../howto/clinic.rst:1696 +#: ../../howto/clinic.rst:1701 msgid "Both of these support two format strings:" msgstr "" -#: ../../howto/clinic.rst:1699 +#: ../../howto/clinic.rst:1704 msgid "``{block comment start}``" msgstr "``{block comment start}``" -#: ../../howto/clinic.rst:1699 +#: ../../howto/clinic.rst:1704 msgid "" "Turns into the string ``/*``, the start-comment text sequence for C files." msgstr "" -#: ../../howto/clinic.rst:1702 +#: ../../howto/clinic.rst:1707 msgid "``{block comment end}``" msgstr "``{block comment end}``" -#: ../../howto/clinic.rst:1702 +#: ../../howto/clinic.rst:1707 msgid "" "Turns into the string ``*/``, the end-comment text sequence for C files." msgstr "" -#: ../../howto/clinic.rst:1704 +#: ../../howto/clinic.rst:1709 msgid "" "The final new directive is one you shouldn't need to use directly, called " "``preserve``:" msgstr "" -#: ../../howto/clinic.rst:1711 +#: ../../howto/clinic.rst:1716 msgid "" "This tells Clinic that the current contents of the output should be kept, " "unmodified. This is used internally by Clinic when dumping output into " @@ -2411,36 +2406,36 @@ msgid "" "gets overwritten." msgstr "" -#: ../../howto/clinic.rst:1718 -msgid "The #ifdef trick" +#: ../../howto/clinic.rst:1723 +msgid "How to use the ``#ifdef`` trick" msgstr "" -#: ../../howto/clinic.rst:1720 +#: ../../howto/clinic.rst:1725 msgid "" "If you're converting a function that isn't available on all platforms, " "there's a trick you can use to make life a little easier. The existing code " "probably looks like this::" msgstr "" -#: ../../howto/clinic.rst:1731 +#: ../../howto/clinic.rst:1736 msgid "" "And then in the ``PyMethodDef`` structure at the bottom the existing code " "will have:" msgstr "" -#: ../../howto/clinic.rst:1740 +#: ../../howto/clinic.rst:1745 msgid "" "In this scenario, you should enclose the body of your impl function inside " "the ``#ifdef``, like so::" msgstr "" -#: ../../howto/clinic.rst:1754 +#: ../../howto/clinic.rst:1759 msgid "" "Then, remove those three lines from the ``PyMethodDef`` structure, replacing " "them with the macro Argument Clinic generated:" msgstr "" -#: ../../howto/clinic.rst:1761 +#: ../../howto/clinic.rst:1766 msgid "" "(You can find the real name for this macro inside the generated code. Or you " "can calculate it yourself: it's the name of your function as defined on the " @@ -2448,27 +2443,27 @@ msgid "" "uppercased, and ``\"_METHODDEF\"`` added to the end.)" msgstr "" -#: ../../howto/clinic.rst:1766 +#: ../../howto/clinic.rst:1771 msgid "" "Perhaps you're wondering: what if ``HAVE_FUNCTIONNAME`` isn't defined? The " "``MODULE_FUNCTIONNAME_METHODDEF`` macro won't be defined either!" msgstr "" -#: ../../howto/clinic.rst:1769 +#: ../../howto/clinic.rst:1774 msgid "" "Here's where Argument Clinic gets very clever. It actually detects that the " "Argument Clinic block might be deactivated by the ``#ifdef``. When that " "happens, it generates a little extra code that looks like this::" msgstr "" -#: ../../howto/clinic.rst:1777 +#: ../../howto/clinic.rst:1782 msgid "" "That means the macro always works. If the function is defined, this turns " "into the correct structure, including the trailing comma. If the function " "is undefined, this turns into nothing." msgstr "" -#: ../../howto/clinic.rst:1781 +#: ../../howto/clinic.rst:1786 msgid "" "However, this causes one ticklish problem: where should Argument Clinic put " "this extra code when using the \"block\" output preset? It can't go in the " @@ -2476,24 +2471,24 @@ msgid "" "the whole point!)" msgstr "" -#: ../../howto/clinic.rst:1785 +#: ../../howto/clinic.rst:1790 msgid "" "In this situation, Argument Clinic writes the extra code to the \"buffer\" " "destination. This may mean that you get a complaint from Argument Clinic:" msgstr "" -#: ../../howto/clinic.rst:1793 +#: ../../howto/clinic.rst:1798 msgid "" "When this happens, just open your file, find the ``dump buffer`` block that " "Argument Clinic added to your file (it'll be at the very bottom), then move " "it above the ``PyMethodDef`` structure where that macro is used." msgstr "" -#: ../../howto/clinic.rst:1800 -msgid "Using Argument Clinic in Python files" +#: ../../howto/clinic.rst:1804 +msgid "How to use Argument Clinic in Python files" msgstr "" -#: ../../howto/clinic.rst:1802 +#: ../../howto/clinic.rst:1806 msgid "" "It's actually possible to use Argument Clinic to preprocess Python files. " "There's no point to using Argument Clinic blocks, of course, as the output " @@ -2501,8 +2496,11 @@ msgid "" "Clinic to run Python blocks lets you use Python as a Python preprocessor!" msgstr "" -#: ../../howto/clinic.rst:1807 +#: ../../howto/clinic.rst:1811 msgid "" "Since Python comments are different from C comments, Argument Clinic blocks " "embedded in Python files look slightly different. They look like this:" msgstr "" + +#~ msgid "Py_buffer" +#~ msgstr "Py_buffer" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index 075e7bc684..c432a4901b 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2023-07-06 00:19+0000\n" "PO-Revision-Date: 2022-01-31 21:41+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,9 @@ msgstr "**原始碼:**\\ :source:`Lib/asyncio/exceptions.py`" msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when the operation has " "exceeded the given deadline." -msgstr ":exc:`TimeoutError` 的一個已被棄用的別名,當操作已超過規定的截止時間時被引發。" +msgstr "" +":exc:`TimeoutError` 的一個已被棄用的別名,當操作已超過規定的截止時間時被引" +"發。" #: ../../library/asyncio-exceptions.rst:21 msgid "This class was made an alias of :exc:`TimeoutError`." @@ -51,8 +53,10 @@ msgstr "" "該例外必須重新被引發。" #: ../../library/asyncio-exceptions.rst:34 -msgid ":exc:`CancelledError` is now a subclass of :class:`BaseException`." -msgstr ":exc:`CancelledError` 現在是 :class:`BaseException` 的子類別。" +msgid "" +":exc:`CancelledError` is now a subclass of :class:`BaseException` rather " +"than :class:`Exception`." +msgstr ":exc:`CancelledError` 現在是 :class:`BaseException` 而非 :class:`Exception` 的子類別。" #: ../../library/asyncio-exceptions.rst:39 msgid "Invalid internal state of :class:`Task` or :class:`Future`." diff --git a/library/crypt.po b/library/crypt.po index bfbac1aaa5..8871578e57 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-07-13 00:19+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-" @@ -26,14 +26,15 @@ msgstr ":mod:`crypt` --- 用於檢查 Unix 密碼的函式" msgid "**Source code:** :source:`Lib/crypt.py`" msgstr "**原始碼:**\\ :source:`Lib/crypt.py`" -#: ../../library/crypt.rst:23 +#: ../../library/crypt.rst:24 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." +"replacement for certain use cases. The `passlib `_ package can replace all use cases of this module." msgstr "" -#: ../../library/crypt.rst:26 +#: ../../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 " @@ -42,7 +43,7 @@ msgid "" "attempting to crack Unix passwords with a dictionary." msgstr "" -#: ../../library/crypt.rst:34 +#: ../../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. " @@ -50,7 +51,7 @@ msgid "" "be available on this module." msgstr "" -#: ../../library/crypt.rst:39 +#: ../../library/crypt.rst:40 msgid ":ref:`Availability `: Unix, not VxWorks." msgstr ":ref:`適用 `:Unix,非 VxWorks。" @@ -65,65 +66,65 @@ msgid "" "more information." msgstr "" -#: ../../library/crypt.rst:44 +#: ../../library/crypt.rst:45 msgid "Hashing Methods" msgstr "" -#: ../../library/crypt.rst:48 +#: ../../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:53 +#: ../../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:58 +#: ../../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:63 +#: ../../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:70 +#: ../../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:75 +#: ../../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:80 +#: ../../library/crypt.rst:81 msgid "Module Attributes" msgstr "模組屬性" -#: ../../library/crypt.rst:86 +#: ../../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:92 +#: ../../library/crypt.rst:93 msgid "Module Functions" msgstr "模組函式" -#: ../../library/crypt.rst:94 +#: ../../library/crypt.rst:95 msgid "The :mod:`crypt` module defines the following functions:" msgstr ":mod:`crypt` 模組定義了以下函式:" -#: ../../library/crypt.rst:98 +#: ../../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 " @@ -133,14 +134,14 @@ msgid "" "strongest method available in :attr:`methods` will be used." msgstr "" -#: ../../library/crypt.rst:105 +#: ../../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:109 +#: ../../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 " @@ -149,36 +150,36 @@ msgid "" "``$digit$``." msgstr "" -#: ../../library/crypt.rst:115 +#: ../../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:120 +#: ../../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:124 +#: ../../library/crypt.rst:125 msgid "Accept ``crypt.METHOD_*`` values in addition to strings for *salt*." msgstr "" -#: ../../library/crypt.rst:130 +#: ../../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:134 +#: ../../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:137 +#: ../../library/crypt.rst:138 msgid "" "*rounds* specifies the number of rounds for ``METHOD_SHA256``, " "``METHOD_SHA512`` and ``METHOD_BLOWFISH``. For ``METHOD_SHA256`` and " @@ -188,29 +189,29 @@ msgid "" "sup:`31`), the default is ``4096`` (2\\ :sup:`12`)." msgstr "" -#: ../../library/crypt.rst:147 +#: ../../library/crypt.rst:148 msgid "Added the *rounds* parameter." msgstr "新增 *rounds* 參數。" -#: ../../library/crypt.rst:152 +#: ../../library/crypt.rst:153 msgid "Examples" msgstr "範例" -#: ../../library/crypt.rst:154 +#: ../../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:174 +#: ../../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:15 ../../library/crypt.rst:32 -#: ../../library/crypt.rst:118 +#: ../../library/crypt.rst:15 ../../library/crypt.rst:33 +#: ../../library/crypt.rst:119 msgid "crypt(3)" msgstr "crypt(3)" diff --git a/library/exceptions.po b/library/exceptions.po index b0828b4fd3..ba9bec1d90 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-29 00:19+0000\n" +"POT-Creation-Date: 2023-07-06 16:53+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-" @@ -990,11 +990,11 @@ msgstr "" msgid "Base class for warnings related to resource usage." msgstr "" -#: ../../library/exceptions.rst:875 +#: ../../library/exceptions.rst:877 msgid "Exception groups" msgstr "" -#: ../../library/exceptions.rst:877 +#: ../../library/exceptions.rst:879 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 " @@ -1003,7 +1003,7 @@ msgid "" "based on the types of the contained exceptions." msgstr "" -#: ../../library/exceptions.rst:886 +#: ../../library/exceptions.rst:888 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 " @@ -1014,7 +1014,7 @@ msgid "" "exc:`BaseExceptionGroup`." msgstr "" -#: ../../library/exceptions.rst:894 +#: ../../library/exceptions.rst:896 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " "rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" @@ -1023,23 +1023,23 @@ msgid "" "`TypeError` if any contained exception is not an :exc:`Exception` subclass." msgstr "" -#: ../../library/exceptions.rst:903 +#: ../../library/exceptions.rst:905 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "" -#: ../../library/exceptions.rst:907 +#: ../../library/exceptions.rst:909 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "" -#: ../../library/exceptions.rst:912 +#: ../../library/exceptions.rst:914 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." msgstr "" -#: ../../library/exceptions.rst:915 +#: ../../library/exceptions.rst:917 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 " @@ -1047,7 +1047,7 @@ msgid "" "the same check that is used in an ``except`` clause." msgstr "" -#: ../../library/exceptions.rst:920 +#: ../../library/exceptions.rst:922 msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of its :attr:`message`, :attr:`__traceback__`, :attr:" @@ -1055,34 +1055,34 @@ msgid "" "groups are omitted from the result." msgstr "" -#: ../../library/exceptions.rst:925 +#: ../../library/exceptions.rst:927 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 " "true for such an exception group, it is included in the result in full." msgstr "" -#: ../../library/exceptions.rst:931 +#: ../../library/exceptions.rst:933 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" "matching part." msgstr "" -#: ../../library/exceptions.rst:937 +#: ../../library/exceptions.rst:939 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "" -#: ../../library/exceptions.rst:940 +#: ../../library/exceptions.rst:942 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`. A subclass needs " "to override it in order to make :meth:`subgroup` and :meth:`split` return " "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" -#: ../../library/exceptions.rst:945 +#: ../../library/exceptions.rst:947 msgid "" ":meth:`subgroup` and :meth:`split` copy the :attr:`__traceback__`, :attr:" "`__cause__`, :attr:`__context__` and :attr:`__notes__` fields from the " @@ -1090,7 +1090,7 @@ msgid "" "fields do not need to be updated by :meth:`derive`. ::" msgstr "" -#: ../../library/exceptions.rst:974 +#: ../../library/exceptions.rst:976 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`__new__`, so subclasses " "that need a different constructor signature need to override that rather " @@ -1099,18 +1099,18 @@ msgid "" "from it. ::" msgstr "" -#: ../../library/exceptions.rst:989 +#: ../../library/exceptions.rst:991 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " "is also a subclass of :exc:`Exception` can only wrap instances of :exc:" "`Exception`." msgstr "" -#: ../../library/exceptions.rst:997 +#: ../../library/exceptions.rst:999 msgid "Exception hierarchy" msgstr "" -#: ../../library/exceptions.rst:999 +#: ../../library/exceptions.rst:1001 msgid "The class hierarchy for built-in exceptions is:" msgstr "" diff --git a/library/functions.po b/library/functions.po index 9455147f6e..616d69ddfd 100644 --- a/library/functions.po +++ b/library/functions.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-30 15:31+0000\n" +"POT-Creation-Date: 2023-07-09 00:21+0000\n" "PO-Revision-Date: 2023-07-02 22:53+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1467,10 +1467,10 @@ msgstr "" msgid "" "For objects with custom :meth:`__hash__` methods, note that :func:`hash` " "truncates the return value based on the bit width of the host machine. See :" -"meth:`__hash__` for details." +"meth:`__hash__ ` for details." msgstr "" "請注意,如果物件實現了自己的 :meth:`__hash__` method,:func:`hash` 根據執行機" -"器的位元長度來擷取回傳值。另請參閱 :meth:`__hash__`。" +"器的位元長度來擷取回傳值。另請參閱 :meth:`__hash__ `。" #: ../../library/functions.rst:801 msgid "" diff --git a/library/sqlite3.po b/library/sqlite3.po index f58e35fd8c..507125b3ae 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-25 19:30+0000\n" +"POT-Creation-Date: 2023-07-12 00: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-" @@ -236,7 +236,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:241 ../../library/sqlite3.rst:557 +#: ../../library/sqlite3.rst:241 ../../library/sqlite3.rst:558 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -267,11 +267,12 @@ msgstr "參數" #: ../../library/sqlite3.rst:266 msgid "" -"The path to the database file to be opened. Pass ``\":memory:\"`` to open a " -"connection to a database that is in RAM instead of on disk." +"The path to the database file to be opened. You can pass ``\":memory:\"`` to " +"create an `SQLite database existing only in memory `_, and open a connection to it." msgstr "" -#: ../../library/sqlite3.rst:272 +#: ../../library/sqlite3.rst:273 msgid "" "How many seconds the connection should wait before raising an :exc:" "`OperationalError` when a table is locked. If another connection opens a " @@ -279,7 +280,7 @@ msgid "" "transaction is committed. Default five seconds." msgstr "" -#: ../../library/sqlite3.rst:279 +#: ../../library/sqlite3.rst:280 msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " @@ -292,7 +293,7 @@ msgid "" "disabled." msgstr "" -#: ../../library/sqlite3.rst:293 +#: ../../library/sqlite3.rst:294 msgid "" "The :attr:`~Connection.isolation_level` of the connection, controlling " "whether and how transactions are implicitly opened. Can be ``\"DEFERRED\"`` " @@ -301,7 +302,7 @@ msgid "" "for more." msgstr "" -#: ../../library/sqlite3.rst:301 +#: ../../library/sqlite3.rst:302 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. " @@ -310,19 +311,19 @@ msgid "" "See :attr:`threadsafety` for more information." msgstr "" -#: ../../library/sqlite3.rst:310 +#: ../../library/sqlite3.rst:311 msgid "" "A custom subclass of :class:`Connection` to create the connection with, if " "not the default :class:`Connection` class." msgstr "" -#: ../../library/sqlite3.rst:314 +#: ../../library/sqlite3.rst:315 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:319 +#: ../../library/sqlite3.rst:320 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 " @@ -335,7 +336,7 @@ msgstr "" msgid "Return type" msgstr "" -#: ../../library/sqlite3.rst:330 +#: ../../library/sqlite3.rst:331 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." @@ -343,7 +344,7 @@ msgstr "" "引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." "connect``。" -#: ../../library/sqlite3.rst:331 +#: ../../library/sqlite3.rst:332 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." @@ -351,20 +352,20 @@ msgstr "" "引發一個附帶引數 ``connection_handle`` 的\\ :ref:`稽核事件 ` " "``sqlite3.connect/handle``。" -#: ../../library/sqlite3.rst:333 +#: ../../library/sqlite3.rst:334 msgid "The *uri* parameter." msgstr "*uri* 參數。" -#: ../../library/sqlite3.rst:336 +#: ../../library/sqlite3.rst:337 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:339 +#: ../../library/sqlite3.rst:340 msgid "The ``sqlite3.connect/handle`` auditing event." msgstr "``sqlite3.connect/handle`` 稽核事件。" -#: ../../library/sqlite3.rst:344 +#: ../../library/sqlite3.rst:345 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 " @@ -372,18 +373,18 @@ msgid "" "and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:350 +#: ../../library/sqlite3.rst:351 msgid "For example:" msgstr "範例:" -#: ../../library/sqlite3.rst:359 +#: ../../library/sqlite3.rst:360 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:365 +#: ../../library/sqlite3.rst:366 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -392,13 +393,13 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:372 +#: ../../library/sqlite3.rst:373 msgid "" "Register an :func:`unraisable hook handler ` for an " "improved debug experience:" msgstr "" -#: ../../library/sqlite3.rst:397 +#: ../../library/sqlite3.rst:398 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 " @@ -406,7 +407,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:405 +#: ../../library/sqlite3.rst:406 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 " @@ -416,17 +417,17 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:413 +#: ../../library/sqlite3.rst:414 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:420 +#: ../../library/sqlite3.rst:421 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:424 +#: ../../library/sqlite3.rst:425 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 " @@ -434,13 +435,13 @@ msgid "" "in square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:434 +#: ../../library/sqlite3.rst:435 msgid "" "This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:439 +#: ../../library/sqlite3.rst:440 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 " @@ -449,61 +450,61 @@ msgid "" "the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:455 +#: ../../library/sqlite3.rst:456 msgid "" "This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:462 +#: ../../library/sqlite3.rst:463 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:465 +#: ../../library/sqlite3.rst:466 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:466 +#: ../../library/sqlite3.rst:467 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:467 +#: ../../library/sqlite3.rst:468 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:471 +#: ../../library/sqlite3.rst:472 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:476 +#: ../../library/sqlite3.rst:477 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:482 +#: ../../library/sqlite3.rst:483 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: ../../library/sqlite3.rst:486 +#: ../../library/sqlite3.rst:487 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:490 +#: ../../library/sqlite3.rst:491 msgid "" "Version number of the runtime SQLite library as a :class:`tuple` of :class:" "`integers `." msgstr "" -#: ../../library/sqlite3.rst:495 +#: ../../library/sqlite3.rst:496 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 " @@ -511,154 +512,154 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: ../../library/sqlite3.rst:500 +#: ../../library/sqlite3.rst:501 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:502 +#: ../../library/sqlite3.rst:503 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:505 +#: ../../library/sqlite3.rst:506 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: ../../library/sqlite3.rst:508 +#: ../../library/sqlite3.rst:509 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:513 msgid "SQLite threading mode" msgstr "" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:513 msgid "`threadsafety`_" msgstr "`threadsafety`_" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:513 msgid "`SQLITE_THREADSAFE`_" msgstr "`SQLITE_THREADSAFE`_" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:513 msgid "DB-API 2.0 meaning" msgstr "" -#: ../../library/sqlite3.rst:515 +#: ../../library/sqlite3.rst:516 msgid "single-thread" msgstr "" -#: ../../library/sqlite3.rst:515 +#: ../../library/sqlite3.rst:516 msgid "0" msgstr "0" -#: ../../library/sqlite3.rst:515 +#: ../../library/sqlite3.rst:516 msgid "Threads may not share the module" msgstr "" -#: ../../library/sqlite3.rst:518 +#: ../../library/sqlite3.rst:519 msgid "multi-thread" msgstr "" -#: ../../library/sqlite3.rst:518 ../../library/sqlite3.rst:521 +#: ../../library/sqlite3.rst:519 ../../library/sqlite3.rst:522 msgid "1" msgstr "1" -#: ../../library/sqlite3.rst:518 +#: ../../library/sqlite3.rst:519 msgid "2" msgstr "2" -#: ../../library/sqlite3.rst:518 +#: ../../library/sqlite3.rst:519 msgid "Threads may share the module, but not connections" msgstr "" -#: ../../library/sqlite3.rst:521 +#: ../../library/sqlite3.rst:522 msgid "serialized" msgstr "" -#: ../../library/sqlite3.rst:521 +#: ../../library/sqlite3.rst:522 msgid "3" msgstr "3" -#: ../../library/sqlite3.rst:521 +#: ../../library/sqlite3.rst:522 msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:528 +#: ../../library/sqlite3.rst:529 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:533 +#: ../../library/sqlite3.rst:534 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:539 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:545 +#: ../../library/sqlite3.rst:546 msgid "Connection objects" msgstr "" -#: ../../library/sqlite3.rst:549 +#: ../../library/sqlite3.rst:550 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:556 +#: ../../library/sqlite3.rst:557 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:559 +#: ../../library/sqlite3.rst:560 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:563 +#: ../../library/sqlite3.rst:564 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:570 +#: ../../library/sqlite3.rst:571 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:573 +#: ../../library/sqlite3.rst:574 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:576 +#: ../../library/sqlite3.rst:577 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:579 +#: ../../library/sqlite3.rst:580 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:582 +#: ../../library/sqlite3.rst:583 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:587 +#: ../../library/sqlite3.rst:588 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -667,111 +668,111 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:591 +#: ../../library/sqlite3.rst:592 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:598 +#: ../../library/sqlite3.rst:599 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:605 +#: ../../library/sqlite3.rst:606 msgid "" "Commit any pending transaction to the database. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:610 +#: ../../library/sqlite3.rst:611 msgid "" "Roll back to the start of any pending transaction. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:616 msgid "" "Close the database connection. Any pending transaction is not committed " "implicitly; make sure to :meth:`commit` before closing to avoid losing " "pending changes." msgstr "" -#: ../../library/sqlite3.rst:622 +#: ../../library/sqlite3.rst:623 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:628 +#: ../../library/sqlite3.rst:629 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:634 +#: ../../library/sqlite3.rst:635 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:640 +#: ../../library/sqlite3.rst:641 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:642 +#: ../../library/sqlite3.rst:643 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:645 +#: ../../library/sqlite3.rst:646 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:649 +#: ../../library/sqlite3.rst:650 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:656 +#: ../../library/sqlite3.rst:657 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:661 +#: ../../library/sqlite3.rst:662 msgid "If *deterministic* is used with SQLite versions older than 3.8.3." msgstr "" -#: ../../library/sqlite3.rst:664 +#: ../../library/sqlite3.rst:665 msgid "The *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:667 ../../library/sqlite3.rst:705 -#: ../../library/sqlite3.rst:768 ../../library/sqlite3.rst:1020 -#: ../../library/sqlite3.rst:1257 ../../library/sqlite3.rst:1384 -#: ../../library/sqlite3.rst:1412 +#: ../../library/sqlite3.rst:668 ../../library/sqlite3.rst:706 +#: ../../library/sqlite3.rst:769 ../../library/sqlite3.rst:1021 +#: ../../library/sqlite3.rst:1258 ../../library/sqlite3.rst:1385 +#: ../../library/sqlite3.rst:1413 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:683 +#: ../../library/sqlite3.rst:684 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:685 +#: ../../library/sqlite3.rst:686 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:688 +#: ../../library/sqlite3.rst:689 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:692 +#: ../../library/sqlite3.rst:693 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -780,45 +781,45 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:693 +#: ../../library/sqlite3.rst:694 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:696 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:696 ../../library/sqlite3.rst:752 +#: ../../library/sqlite3.rst:697 ../../library/sqlite3.rst:753 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:699 +#: ../../library/sqlite3.rst:700 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:702 +#: ../../library/sqlite3.rst:703 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:737 +#: ../../library/sqlite3.rst:738 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:739 +#: ../../library/sqlite3.rst:740 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:742 +#: ../../library/sqlite3.rst:743 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:746 +#: ../../library/sqlite3.rst:747 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -830,79 +831,79 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:747 +#: ../../library/sqlite3.rst:748 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:749 +#: ../../library/sqlite3.rst:750 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:750 +#: ../../library/sqlite3.rst:751 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:751 +#: ../../library/sqlite3.rst:752 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:755 +#: ../../library/sqlite3.rst:756 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:758 +#: ../../library/sqlite3.rst:759 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:760 +#: ../../library/sqlite3.rst:761 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:824 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:827 +#: ../../library/sqlite3.rst:828 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:829 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:829 +#: ../../library/sqlite3.rst:830 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:831 +#: ../../library/sqlite3.rst:832 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:859 +#: ../../library/sqlite3.rst:860 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:861 +#: ../../library/sqlite3.rst:862 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:868 +#: ../../library/sqlite3.rst:869 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:875 +#: ../../library/sqlite3.rst:876 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 " @@ -911,7 +912,7 @@ msgid "" "underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:882 +#: ../../library/sqlite3.rst:883 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`` " @@ -921,7 +922,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:889 +#: ../../library/sqlite3.rst:890 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 " @@ -929,15 +930,15 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:893 +#: ../../library/sqlite3.rst:894 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:895 +#: ../../library/sqlite3.rst:896 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:901 +#: ../../library/sqlite3.rst:902 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 " @@ -945,26 +946,26 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:906 +#: ../../library/sqlite3.rst:907 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:909 +#: ../../library/sqlite3.rst:910 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise an :exc:`OperationalError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:916 +#: ../../library/sqlite3.rst:917 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:919 +#: ../../library/sqlite3.rst:920 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 " @@ -974,18 +975,18 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:927 +#: ../../library/sqlite3.rst:928 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:930 +#: ../../library/sqlite3.rst:931 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:940 +#: ../../library/sqlite3.rst:941 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -994,7 +995,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:949 +#: ../../library/sqlite3.rst:950 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1003,7 +1004,7 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:956 +#: ../../library/sqlite3.rst:957 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1011,18 +1012,18 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:960 +#: ../../library/sqlite3.rst:961 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1003 +#: ../../library/sqlite3.rst:1004 msgid "" "Load an SQLite extension from a shared library located at *path*. Enable " "extension loading with :meth:`enable_load_extension` before calling this " "method." msgstr "" -#: ../../library/sqlite3.rst:1007 +#: ../../library/sqlite3.rst:1008 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1030,38 +1031,38 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1011 +#: ../../library/sqlite3.rst:1012 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1016 +#: ../../library/sqlite3.rst:1017 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:1034 +#: ../../library/sqlite3.rst:1035 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1036 +#: ../../library/sqlite3.rst:1037 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1039 +#: ../../library/sqlite3.rst:1040 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1042 +#: ../../library/sqlite3.rst:1043 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:1048 +#: ../../library/sqlite3.rst:1049 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* " @@ -1069,46 +1070,46 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1057 +#: ../../library/sqlite3.rst:1058 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:1064 +#: ../../library/sqlite3.rst:1065 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1068 +#: ../../library/sqlite3.rst:1069 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1087 +#: ../../library/sqlite3.rst:1088 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1099 +#: ../../library/sqlite3.rst:1100 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1101 +#: ../../library/sqlite3.rst:1102 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1106 ../../library/sqlite3.rst:1143 +#: ../../library/sqlite3.rst:1107 ../../library/sqlite3.rst:1144 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1109 +#: ../../library/sqlite3.rst:1110 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1129 +#: ../../library/sqlite3.rst:1130 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 " @@ -1116,22 +1117,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1134 +#: ../../library/sqlite3.rst:1135 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1137 +#: ../../library/sqlite3.rst:1138 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1146 +#: ../../library/sqlite3.rst:1147 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1163 +#: ../../library/sqlite3.rst:1164 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-" @@ -1140,17 +1141,17 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1169 +#: ../../library/sqlite3.rst:1170 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1177 +#: ../../library/sqlite3.rst:1178 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1185 +#: ../../library/sqlite3.rst:1186 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1158,47 +1159,47 @@ msgid "" "serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1191 +#: ../../library/sqlite3.rst:1192 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1194 +#: ../../library/sqlite3.rst:1195 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1198 +#: ../../library/sqlite3.rst:1199 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1202 +#: ../../library/sqlite3.rst:1203 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1205 +#: ../../library/sqlite3.rst:1206 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1210 +#: ../../library/sqlite3.rst:1211 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1217 +#: ../../library/sqlite3.rst:1218 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1220 +#: ../../library/sqlite3.rst:1221 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1227 +#: ../../library/sqlite3.rst:1228 msgid "" "This attribute controls the :ref:`transaction handling ` performed by :mod:`!sqlite3`. If set to ``None``, " @@ -1208,13 +1209,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1235 +#: ../../library/sqlite3.rst:1236 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:1240 +#: ../../library/sqlite3.rst:1241 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1223,12 +1224,12 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1247 ../../library/sqlite3.rst:1539 -#: ../../library/sqlite3.rst:1562 +#: ../../library/sqlite3.rst:1248 ../../library/sqlite3.rst:1540 +#: ../../library/sqlite3.rst:1563 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "" -#: ../../library/sqlite3.rst:1251 +#: ../../library/sqlite3.rst:1252 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 " @@ -1236,17 +1237,17 @@ msgid "" "If you want to return ``bytes`` instead, set *text_factory* to ``bytes``." msgstr "" -#: ../../library/sqlite3.rst:1291 +#: ../../library/sqlite3.rst:1292 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:1298 +#: ../../library/sqlite3.rst:1299 msgid "Cursor objects" msgstr "" -#: ../../library/sqlite3.rst:1300 +#: ../../library/sqlite3.rst:1301 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 " @@ -1254,39 +1255,39 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1307 +#: ../../library/sqlite3.rst:1308 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:1332 +#: ../../library/sqlite3.rst:1333 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1339 +#: ../../library/sqlite3.rst:1340 msgid "" "Execute SQL a single SQL statement, optionally binding Python values using :" "ref:`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1343 +#: ../../library/sqlite3.rst:1344 msgid "A single SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1346 +#: ../../library/sqlite3.rst:1347 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:1353 +#: ../../library/sqlite3.rst:1354 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1356 +#: ../../library/sqlite3.rst:1357 msgid "" "If :attr:`~Connection.isolation_level` is not ``None``, *sql* is an " "``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is " @@ -1294,43 +1295,43 @@ msgid "" "*sql*." msgstr "" -#: ../../library/sqlite3.rst:1361 +#: ../../library/sqlite3.rst:1362 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1365 +#: ../../library/sqlite3.rst:1366 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1369 +#: ../../library/sqlite3.rst:1370 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1371 +#: ../../library/sqlite3.rst:1372 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1374 +#: ../../library/sqlite3.rst:1375 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1380 +#: ../../library/sqlite3.rst:1381 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statment." msgstr "" -#: ../../library/sqlite3.rst:1397 +#: ../../library/sqlite3.rst:1398 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1404 +#: ../../library/sqlite3.rst:1405 msgid "" "Execute the SQL statements in *sql_script*. If there is a pending " "transaction, an implicit ``COMMIT`` statement is executed first. No other " @@ -1338,24 +1339,24 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1410 +#: ../../library/sqlite3.rst:1411 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1428 +#: ../../library/sqlite3.rst:1429 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:1436 +#: ../../library/sqlite3.rst:1437 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:1439 +#: ../../library/sqlite3.rst:1440 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 " @@ -1363,7 +1364,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1445 +#: ../../library/sqlite3.rst:1446 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1371,36 +1372,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1452 +#: ../../library/sqlite3.rst:1453 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:1459 +#: ../../library/sqlite3.rst:1460 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1461 +#: ../../library/sqlite3.rst:1462 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:1466 ../../library/sqlite3.rst:1470 +#: ../../library/sqlite3.rst:1467 ../../library/sqlite3.rst:1471 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1474 +#: ../../library/sqlite3.rst:1475 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:1479 +#: ../../library/sqlite3.rst:1480 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -1408,18 +1409,18 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1493 +#: ../../library/sqlite3.rst:1494 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:1497 +#: ../../library/sqlite3.rst:1498 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1501 +#: ../../library/sqlite3.rst:1502 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 " @@ -1429,15 +1430,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1509 +#: ../../library/sqlite3.rst:1510 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1511 +#: ../../library/sqlite3.rst:1512 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1516 +#: ../../library/sqlite3.rst:1517 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -1447,7 +1448,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1527 +#: ../../library/sqlite3.rst:1528 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 " @@ -1456,18 +1457,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1534 +#: ../../library/sqlite3.rst:1535 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:1550 +#: ../../library/sqlite3.rst:1551 msgid "Row objects" msgstr "" -#: ../../library/sqlite3.rst:1554 +#: ../../library/sqlite3.rst:1555 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -1475,28 +1476,28 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1559 +#: ../../library/sqlite3.rst:1560 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1566 +#: ../../library/sqlite3.rst:1567 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:1570 +#: ../../library/sqlite3.rst:1571 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:1577 +#: ../../library/sqlite3.rst:1578 msgid "Blob objects" msgstr "" -#: ../../library/sqlite3.rst:1583 +#: ../../library/sqlite3.rst:1584 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:" @@ -1504,24 +1505,24 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1588 +#: ../../library/sqlite3.rst:1589 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1618 +#: ../../library/sqlite3.rst:1619 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1620 +#: ../../library/sqlite3.rst:1621 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:1626 +#: ../../library/sqlite3.rst:1627 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)` " @@ -1529,18 +1530,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1634 +#: ../../library/sqlite3.rst:1635 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:1640 +#: ../../library/sqlite3.rst:1641 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1644 +#: ../../library/sqlite3.rst:1645 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :data:`os.SEEK_SET` (absolute blob positioning). Other " @@ -1548,26 +1549,26 @@ msgid "" "position) and :data:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1652 +#: ../../library/sqlite3.rst:1653 msgid "PrepareProtocol objects" msgstr "" -#: ../../library/sqlite3.rst:1656 +#: ../../library/sqlite3.rst:1657 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:1664 +#: ../../library/sqlite3.rst:1665 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1666 +#: ../../library/sqlite3.rst:1667 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1670 +#: ../../library/sqlite3.rst:1671 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-" @@ -1575,39 +1576,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1677 +#: ../../library/sqlite3.rst:1678 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:1681 +#: ../../library/sqlite3.rst:1682 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1686 +#: ../../library/sqlite3.rst:1687 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1693 +#: ../../library/sqlite3.rst:1694 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1700 +#: ../../library/sqlite3.rst:1701 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:1707 +#: ../../library/sqlite3.rst:1708 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 " @@ -1615,14 +1616,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1714 +#: ../../library/sqlite3.rst:1715 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:1720 +#: ../../library/sqlite3.rst:1721 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 " @@ -1630,20 +1631,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1728 +#: ../../library/sqlite3.rst:1729 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:1733 +#: ../../library/sqlite3.rst:1734 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:1740 +#: ../../library/sqlite3.rst:1741 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 " @@ -1651,7 +1652,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1747 +#: ../../library/sqlite3.rst:1748 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -1660,78 +1661,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1757 +#: ../../library/sqlite3.rst:1758 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1759 +#: ../../library/sqlite3.rst:1760 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1762 +#: ../../library/sqlite3.rst:1763 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1765 ../../library/sqlite3.rst:1782 +#: ../../library/sqlite3.rst:1766 ../../library/sqlite3.rst:1783 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1765 ../../library/sqlite3.rst:1782 +#: ../../library/sqlite3.rst:1766 ../../library/sqlite3.rst:1783 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1767 ../../library/sqlite3.rst:1784 +#: ../../library/sqlite3.rst:1768 ../../library/sqlite3.rst:1785 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1767 ../../library/sqlite3.rst:1784 +#: ../../library/sqlite3.rst:1768 ../../library/sqlite3.rst:1785 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1769 ../../library/sqlite3.rst:1786 +#: ../../library/sqlite3.rst:1770 ../../library/sqlite3.rst:1787 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1769 ../../library/sqlite3.rst:1786 +#: ../../library/sqlite3.rst:1770 ../../library/sqlite3.rst:1787 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1771 ../../library/sqlite3.rst:1788 +#: ../../library/sqlite3.rst:1772 ../../library/sqlite3.rst:1789 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1771 ../../library/sqlite3.rst:1788 +#: ../../library/sqlite3.rst:1772 ../../library/sqlite3.rst:1789 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1773 +#: ../../library/sqlite3.rst:1774 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1773 ../../library/sqlite3.rst:1790 +#: ../../library/sqlite3.rst:1774 ../../library/sqlite3.rst:1791 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1775 ../../library/sqlite3.rst:1793 +#: ../../library/sqlite3.rst:1776 ../../library/sqlite3.rst:1794 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1775 ../../library/sqlite3.rst:1793 +#: ../../library/sqlite3.rst:1776 ../../library/sqlite3.rst:1794 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1779 +#: ../../library/sqlite3.rst:1780 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1790 +#: ../../library/sqlite3.rst:1791 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1796 +#: ../../library/sqlite3.rst:1797 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 " @@ -1740,42 +1741,42 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1806 +#: ../../library/sqlite3.rst:1807 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:1809 msgid "" "There are default adapters for the date and datetime types in the datetime " "module. They will be sent as ISO dates/ISO timestamps to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1811 +#: ../../library/sqlite3.rst:1812 msgid "" "The default converters are registered under the name \"date\" for :class:" "`datetime.date` and under the name \"timestamp\" for :class:`datetime." "datetime`." msgstr "" -#: ../../library/sqlite3.rst:1815 +#: ../../library/sqlite3.rst:1816 msgid "" "This way, you can use date/timestamps from Python without any additional " "fiddling in most cases. The format of the adapters is also compatible with " "the experimental SQLite date/time functions." msgstr "" -#: ../../library/sqlite3.rst:1819 +#: ../../library/sqlite3.rst:1820 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1823 +#: ../../library/sqlite3.rst:1824 msgid "" "If a timestamp stored in SQLite has a fractional part longer than 6 numbers, " "its value will be truncated to microsecond precision by the timestamp " "converter." msgstr "" -#: ../../library/sqlite3.rst:1829 +#: ../../library/sqlite3.rst:1830 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1783,15 +1784,15 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1838 +#: ../../library/sqlite3.rst:1839 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:1843 +#: ../../library/sqlite3.rst:1844 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:1845 +#: ../../library/sqlite3.rst:1846 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 " @@ -1799,7 +1800,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:1858 +#: ../../library/sqlite3.rst:1859 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 " @@ -1807,7 +1808,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:1863 +#: ../../library/sqlite3.rst:1864 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, " @@ -1818,24 +1819,24 @@ msgid "" "are ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:1900 +#: ../../library/sqlite3.rst:1901 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:1907 +#: ../../library/sqlite3.rst:1908 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:1909 +#: ../../library/sqlite3.rst:1910 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:1913 +#: ../../library/sqlite3.rst:1914 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 " @@ -1845,11 +1846,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:1925 +#: ../../library/sqlite3.rst:1926 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:1927 +#: ../../library/sqlite3.rst:1928 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -1859,84 +1860,84 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1958 +#: ../../library/sqlite3.rst:1959 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:1961 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:1990 +#: ../../library/sqlite3.rst:1991 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1992 +#: ../../library/sqlite3.rst:1993 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:1997 +#: ../../library/sqlite3.rst:1998 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:2000 +#: ../../library/sqlite3.rst:2001 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:2005 +#: ../../library/sqlite3.rst:2006 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2014 +#: ../../library/sqlite3.rst:2015 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:2018 +#: ../../library/sqlite3.rst:2019 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2019 +#: ../../library/sqlite3.rst:2020 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2020 +#: ../../library/sqlite3.rst:2021 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2024 +#: ../../library/sqlite3.rst:2025 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2075 +#: ../../library/sqlite3.rst:2076 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2077 +#: ../../library/sqlite3.rst:2078 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2139 +#: ../../library/sqlite3.rst:2140 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2141 +#: ../../library/sqlite3.rst:2142 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -1948,11 +1949,11 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:2182 +#: ../../library/sqlite3.rst:2183 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2184 +#: ../../library/sqlite3.rst:2185 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -1962,58 +1963,58 @@ msgid "" "exception, the transaction is rolled back." msgstr "" -#: ../../library/sqlite3.rst:2193 +#: ../../library/sqlite3.rst:2194 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, the context manager is a no-op." msgstr "" -#: ../../library/sqlite3.rst:2198 +#: ../../library/sqlite3.rst:2199 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection." msgstr "" -#: ../../library/sqlite3.rst:2231 +#: ../../library/sqlite3.rst:2232 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2233 +#: ../../library/sqlite3.rst:2234 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2235 +#: ../../library/sqlite3.rst:2236 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2244 +#: ../../library/sqlite3.rst:2245 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:2254 +#: ../../library/sqlite3.rst:2255 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2268 +#: ../../library/sqlite3.rst:2269 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2277 +#: ../../library/sqlite3.rst:2278 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2279 +#: ../../library/sqlite3.rst:2280 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:2284 +#: ../../library/sqlite3.rst:2285 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -2021,7 +2022,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2289 +#: ../../library/sqlite3.rst:2290 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -2029,51 +2030,59 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2299 +#: ../../library/sqlite3.rst:2300 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2314 +#: ../../library/sqlite3.rst:2317 +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 " +"defined by expressions, e.g. literals, with the given aliases ``expr AS " +"alias``." +msgstr "" + +#: ../../library/sqlite3.rst:2322 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:2323 +#: ../../library/sqlite3.rst:2331 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2333 +#: ../../library/sqlite3.rst:2341 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2344 +#: ../../library/sqlite3.rst:2352 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2359 +#: ../../library/sqlite3.rst:2367 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:2367 +#: ../../library/sqlite3.rst:2375 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2372 +#: ../../library/sqlite3.rst:2380 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2374 +#: ../../library/sqlite3.rst:2382 msgid "" "The :mod:`!sqlite3` module does not adhere to the transaction handling " "recommended by :pep:`249`." msgstr "" -#: ../../library/sqlite3.rst:2377 +#: ../../library/sqlite3.rst:2385 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -2087,7 +2096,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2390 +#: ../../library/sqlite3.rst:2398 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -2097,27 +2106,27 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2398 +#: ../../library/sqlite3.rst:2406 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:2402 +#: ../../library/sqlite3.rst:2410 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1335 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1334 ../../library/sqlite3.rst:1335 +#: ../../library/sqlite3.rst:1335 ../../library/sqlite3.rst:1336 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1335 +#: ../../library/sqlite3.rst:1336 msgid ": (colon)" msgstr ": (冒號)" diff --git a/library/stdtypes.po b/library/stdtypes.po index 46c97e854d..e24d0398d3 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-23 16:50+0800\n" +"POT-Creation-Date: 2023-07-15 00:19+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-" @@ -4238,53 +4238,54 @@ msgstr "" 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." +"'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:3963 +#: ../../library/stdtypes.rst:3964 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:3986 +#: ../../library/stdtypes.rst:3987 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:3999 +#: ../../library/stdtypes.rst:4000 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4025 +#: ../../library/stdtypes.rst:4026 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4039 +#: ../../library/stdtypes.rst:4040 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4042 +#: ../../library/stdtypes.rst:4043 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4046 +#: ../../library/stdtypes.rst:4047 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4058 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:4076 +#: ../../library/stdtypes.rst:4077 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4093 +#: ../../library/stdtypes.rst:4094 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4097 +#: ../../library/stdtypes.rst:4098 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 " @@ -4292,59 +4293,59 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4102 +#: ../../library/stdtypes.rst:4103 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:4108 +#: ../../library/stdtypes.rst:4109 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:4122 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4127 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:4129 ../../library/stdtypes.rst:4137 +#: ../../library/stdtypes.rst:4130 ../../library/stdtypes.rst:4138 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4135 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:4142 +#: ../../library/stdtypes.rst:4143 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4146 +#: ../../library/stdtypes.rst:4147 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4152 +#: ../../library/stdtypes.rst:4153 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4159 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4166 +#: ../../library/stdtypes.rst:4167 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4170 +#: ../../library/stdtypes.rst:4171 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -4354,7 +4355,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:4178 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 " @@ -4362,7 +4363,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4182 +#: ../../library/stdtypes.rst:4183 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -4374,18 +4375,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4190 +#: ../../library/stdtypes.rst:4191 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:4194 +#: ../../library/stdtypes.rst:4195 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4199 +#: ../../library/stdtypes.rst:4200 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 " @@ -4393,92 +4394,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4205 +#: ../../library/stdtypes.rst:4206 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:4208 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4208 +#: ../../library/stdtypes.rst:4209 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4210 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4212 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4216 +#: ../../library/stdtypes.rst:4217 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4220 +#: ../../library/stdtypes.rst:4221 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4224 +#: ../../library/stdtypes.rst:4225 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4228 +#: ../../library/stdtypes.rst:4229 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:4234 +#: ../../library/stdtypes.rst:4235 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4238 +#: ../../library/stdtypes.rst:4239 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4244 +#: ../../library/stdtypes.rst:4245 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4248 +#: ../../library/stdtypes.rst:4249 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4254 +#: ../../library/stdtypes.rst:4255 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4259 +#: ../../library/stdtypes.rst:4260 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4264 +#: ../../library/stdtypes.rst:4265 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4269 +#: ../../library/stdtypes.rst:4270 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4273 +#: ../../library/stdtypes.rst:4274 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4277 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -4488,7 +4489,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4283 +#: ../../library/stdtypes.rst:4284 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 " @@ -4498,14 +4499,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4291 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:4294 +#: ../../library/stdtypes.rst:4295 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 " @@ -4513,71 +4514,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4300 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:4302 +#: ../../library/stdtypes.rst:4303 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4304 +#: ../../library/stdtypes.rst:4305 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:4308 +#: ../../library/stdtypes.rst:4309 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4314 +#: ../../library/stdtypes.rst:4315 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4319 +#: ../../library/stdtypes.rst:4320 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4324 +#: ../../library/stdtypes.rst:4325 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4330 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4333 +#: ../../library/stdtypes.rst:4334 msgid "Add element *elem* to the set." msgstr "" -#: ../../library/stdtypes.rst:4337 +#: ../../library/stdtypes.rst:4338 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4342 +#: ../../library/stdtypes.rst:4343 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4346 +#: ../../library/stdtypes.rst:4347 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4351 +#: ../../library/stdtypes.rst:4352 msgid "Remove all elements from the set." msgstr "" -#: ../../library/stdtypes.rst:4354 +#: ../../library/stdtypes.rst:4355 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -4585,18 +4586,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4360 msgid "" "Note, the *elem* argument to the :meth:`__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:4367 +#: ../../library/stdtypes.rst:4368 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:4378 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -4605,7 +4606,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4383 +#: ../../library/stdtypes.rst:4384 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -4614,33 +4615,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4395 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4397 +#: ../../library/stdtypes.rst:4398 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4399 +#: ../../library/stdtypes.rst:4400 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:4401 +#: ../../library/stdtypes.rst:4402 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4403 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4405 +#: ../../library/stdtypes.rst:4406 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 " @@ -4652,7 +4653,7 @@ msgid "" "value for that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:4416 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 " @@ -4660,39 +4661,39 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4420 +#: ../../library/stdtypes.rst:4421 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4432 +#: ../../library/stdtypes.rst:4433 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:4436 +#: ../../library/stdtypes.rst:4437 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:4442 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4445 +#: ../../library/stdtypes.rst:4446 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4450 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4455 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 " @@ -4703,51 +4704,51 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4472 +#: ../../library/stdtypes.rst:4473 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:4478 +#: ../../library/stdtypes.rst:4479 msgid "Set ``d[key]`` to *value*." msgstr "" -#: ../../library/stdtypes.rst:4482 +#: ../../library/stdtypes.rst:4483 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" -#: ../../library/stdtypes.rst:4487 +#: ../../library/stdtypes.rst:4488 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "" -#: ../../library/stdtypes.rst:4491 +#: ../../library/stdtypes.rst:4492 msgid "Equivalent to ``not key in d``." msgstr "" -#: ../../library/stdtypes.rst:4495 +#: ../../library/stdtypes.rst:4496 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4500 +#: ../../library/stdtypes.rst:4501 msgid "Remove all items from the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4504 +#: ../../library/stdtypes.rst:4505 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4508 +#: ../../library/stdtypes.rst:4509 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4510 +#: ../../library/stdtypes.rst:4511 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 " @@ -4756,70 +4757,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4518 +#: ../../library/stdtypes.rst:4519 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:4524 +#: ../../library/stdtypes.rst:4525 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4529 +#: ../../library/stdtypes.rst:4530 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4534 +#: ../../library/stdtypes.rst:4535 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:4540 +#: ../../library/stdtypes.rst:4541 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:4543 +#: ../../library/stdtypes.rst:4544 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:4547 +#: ../../library/stdtypes.rst:4548 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4553 +#: ../../library/stdtypes.rst:4554 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4560 +#: ../../library/stdtypes.rst:4561 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:4566 +#: ../../library/stdtypes.rst:4567 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4569 +#: ../../library/stdtypes.rst:4570 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 " @@ -4827,71 +4828,71 @@ msgid "" "pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4576 +#: ../../library/stdtypes.rst:4577 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4579 +#: ../../library/stdtypes.rst:4580 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:4589 +#: ../../library/stdtypes.rst:4590 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:4597 +#: ../../library/stdtypes.rst:4598 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:4603 +#: ../../library/stdtypes.rst:4604 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:4607 +#: ../../library/stdtypes.rst:4608 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:4625 +#: ../../library/stdtypes.rst:4626 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4630 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4642 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4646 +#: ../../library/stdtypes.rst:4647 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4654 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4655 +#: ../../library/stdtypes.rst:4656 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 " @@ -4899,23 +4900,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4660 +#: ../../library/stdtypes.rst:4661 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4666 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4669 +#: ../../library/stdtypes.rst:4670 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4672 +#: ../../library/stdtypes.rst:4673 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -4923,39 +4924,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4677 +#: ../../library/stdtypes.rst:4678 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:4680 +#: ../../library/stdtypes.rst:4681 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4685 +#: ../../library/stdtypes.rst:4686 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:4690 +#: ../../library/stdtypes.rst:4691 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:4693 +#: ../../library/stdtypes.rst:4694 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4698 +#: ../../library/stdtypes.rst:4699 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4703 +#: ../../library/stdtypes.rst:4704 msgid "" "Keys views are set-like since their entries are unique and :term:" "`hashable`. If all values are hashable, so that ``(key, value)`` pairs are " @@ -4966,15 +4967,15 @@ msgid "" "``<``, or ``^``)." msgstr "" -#: ../../library/stdtypes.rst:4710 +#: ../../library/stdtypes.rst:4711 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4754 msgid "Context Manager Types" msgstr "" -#: ../../library/stdtypes.rst:4758 +#: ../../library/stdtypes.rst:4761 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 " @@ -4982,7 +4983,7 @@ msgid "" "before the statement body is executed and exited when the statement ends:" msgstr "" -#: ../../library/stdtypes.rst:4766 +#: ../../library/stdtypes.rst:4769 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 " @@ -4990,14 +4991,14 @@ msgid "" "using this context manager." msgstr "" -#: ../../library/stdtypes.rst:4771 +#: ../../library/stdtypes.rst:4774 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." msgstr "" -#: ../../library/stdtypes.rst:4775 +#: ../../library/stdtypes.rst:4778 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 " @@ -5007,7 +5008,7 @@ msgid "" "the :keyword:`!with` statement." msgstr "" -#: ../../library/stdtypes.rst:4785 +#: ../../library/stdtypes.rst:4788 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -5016,7 +5017,7 @@ msgid "" "arguments are ``None``." msgstr "" -#: ../../library/stdtypes.rst:4790 +#: ../../library/stdtypes.rst:4793 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -5027,7 +5028,7 @@ msgid "" "statement." msgstr "" -#: ../../library/stdtypes.rst:4797 +#: ../../library/stdtypes.rst:4800 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -5036,7 +5037,7 @@ msgid "" "method has actually failed." msgstr "" -#: ../../library/stdtypes.rst:4803 +#: ../../library/stdtypes.rst:4806 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -5045,7 +5046,7 @@ msgid "" "management protocol. See the :mod:`contextlib` module for some examples." msgstr "" -#: ../../library/stdtypes.rst:4809 +#: ../../library/stdtypes.rst:4812 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -5055,7 +5056,7 @@ msgid "" "rather than the iterator produced by an undecorated generator function." msgstr "" -#: ../../library/stdtypes.rst:4816 +#: ../../library/stdtypes.rst:4819 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 " @@ -5064,23 +5065,23 @@ msgid "" "a single class dictionary lookup is negligible." msgstr "" -#: ../../library/stdtypes.rst:4824 +#: ../../library/stdtypes.rst:4827 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" msgstr "" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4832 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." msgstr "" -#: ../../library/stdtypes.rst:4836 +#: ../../library/stdtypes.rst:4839 msgid "Generic Alias Type" msgstr "" -#: ../../library/stdtypes.rst:4842 +#: ../../library/stdtypes.rst:4845 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -5090,19 +5091,19 @@ msgid "" "are intended primarily for use with :term:`type annotations `." msgstr "" -#: ../../library/stdtypes.rst:4852 +#: ../../library/stdtypes.rst:4855 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." msgstr "" -#: ../../library/stdtypes.rst:4855 +#: ../../library/stdtypes.rst:4858 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." msgstr "" -#: ../../library/stdtypes.rst:4858 +#: ../../library/stdtypes.rst:4861 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 " @@ -5111,7 +5112,7 @@ msgid "" "`bytes`." msgstr "" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4867 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 " @@ -5120,7 +5121,7 @@ msgid "" "the :class:`str` data type and the :class:`bytes` data type:" msgstr "" -#: ../../library/stdtypes.rst:4870 +#: ../../library/stdtypes.rst:4873 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 " @@ -5128,7 +5129,7 @@ msgid "" "annotations with the ``GenericAlias`` ``re.Match[str]``." msgstr "" -#: ../../library/stdtypes.rst:4876 +#: ../../library/stdtypes.rst:4879 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." @@ -5137,21 +5138,21 @@ msgid "" "objects>` objects with ``re.Match[bytes]``." msgstr "" -#: ../../library/stdtypes.rst:4882 +#: ../../library/stdtypes.rst:4885 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " "directly." msgstr "" -#: ../../library/stdtypes.rst:4888 +#: ../../library/stdtypes.rst:4891 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 "" -#: ../../library/stdtypes.rst:4896 +#: ../../library/stdtypes.rst:4899 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 " @@ -5159,13 +5160,13 @@ msgid "" "of type :class:`str` and values of type :class:`int`::" msgstr "" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4907 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" msgstr "" -#: ../../library/stdtypes.rst:4912 +#: ../../library/stdtypes.rst:4915 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -5174,331 +5175,331 @@ msgid "" "discouraged, but will run without errors::" msgstr "" -#: ../../library/stdtypes.rst:4922 +#: ../../library/stdtypes.rst:4925 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4936 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "" -#: ../../library/stdtypes.rst:4941 +#: ../../library/stdtypes.rst:4944 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -#: ../../library/stdtypes.rst:4949 +#: ../../library/stdtypes.rst:4952 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 "" -#: ../../library/stdtypes.rst:4960 +#: ../../library/stdtypes.rst:4963 msgid "Standard Generic Classes" msgstr "" -#: ../../library/stdtypes.rst:4962 +#: ../../library/stdtypes.rst:4965 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "" -#: ../../library/stdtypes.rst:4965 +#: ../../library/stdtypes.rst:4968 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:4969 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:4967 +#: ../../library/stdtypes.rst:4970 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:4968 +#: ../../library/stdtypes.rst:4971 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:4969 +#: ../../library/stdtypes.rst:4972 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:4970 +#: ../../library/stdtypes.rst:4973 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:4971 +#: ../../library/stdtypes.rst:4974 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:4972 +#: ../../library/stdtypes.rst:4975 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:4973 +#: ../../library/stdtypes.rst:4976 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:4977 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:4975 +#: ../../library/stdtypes.rst:4978 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:4979 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:4980 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:4978 +#: ../../library/stdtypes.rst:4981 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:4979 +#: ../../library/stdtypes.rst:4982 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:4983 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:4981 +#: ../../library/stdtypes.rst:4984 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:4982 +#: ../../library/stdtypes.rst:4985 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:4986 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:4984 +#: ../../library/stdtypes.rst:4987 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:4985 +#: ../../library/stdtypes.rst:4988 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:4986 +#: ../../library/stdtypes.rst:4989 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:4987 +#: ../../library/stdtypes.rst:4990 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:4991 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:4989 +#: ../../library/stdtypes.rst:4992 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:4990 +#: ../../library/stdtypes.rst:4993 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:4991 +#: ../../library/stdtypes.rst:4994 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:4992 +#: ../../library/stdtypes.rst:4995 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:4993 +#: ../../library/stdtypes.rst:4996 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:4997 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:4995 +#: ../../library/stdtypes.rst:4998 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:4996 +#: ../../library/stdtypes.rst:4999 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:4997 +#: ../../library/stdtypes.rst:5000 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5001 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5002 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5003 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5004 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5002 +#: ../../library/stdtypes.rst:5005 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5003 +#: ../../library/stdtypes.rst:5006 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5004 +#: ../../library/stdtypes.rst:5007 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5005 +#: ../../library/stdtypes.rst:5008 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5006 +#: ../../library/stdtypes.rst:5009 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5010 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5008 +#: ../../library/stdtypes.rst:5011 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5009 +#: ../../library/stdtypes.rst:5012 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5010 +#: ../../library/stdtypes.rst:5013 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5011 +#: ../../library/stdtypes.rst:5014 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5012 +#: ../../library/stdtypes.rst:5015 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5013 +#: ../../library/stdtypes.rst:5016 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5014 +#: ../../library/stdtypes.rst:5017 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5018 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5016 +#: ../../library/stdtypes.rst:5019 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5020 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5018 +#: ../../library/stdtypes.rst:5021 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5023 +#: ../../library/stdtypes.rst:5026 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5028 msgid "All parameterized generics implement special read-only attributes." msgstr "" -#: ../../library/stdtypes.rst:5029 +#: ../../library/stdtypes.rst:5032 msgid "This attribute points at the non-parameterized generic class::" msgstr "" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5040 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 "" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5050 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" msgstr "" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5061 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." msgstr "" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5068 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5077 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5077 msgid "Introducing Python's framework for type annotations." msgstr "" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5082 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr "" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5080 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." "__class_getitem__`." msgstr "" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5085 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" msgstr "" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5085 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5094 msgid "Union Type" msgstr "" -#: ../../library/stdtypes.rst:5097 +#: ../../library/stdtypes.rst:5100 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -5507,7 +5508,7 @@ msgid "" "Union`." msgstr "" -#: ../../library/stdtypes.rst:5104 +#: ../../library/stdtypes.rst:5107 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 " @@ -5515,7 +5516,7 @@ msgid "" "class:`float`::" msgstr "" -#: ../../library/stdtypes.rst:5114 +#: ../../library/stdtypes.rst:5117 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 " @@ -5524,76 +5525,76 @@ msgid "" "a string, e.g. ``\"int | Foo\"``." msgstr "" -#: ../../library/stdtypes.rst:5122 +#: ../../library/stdtypes.rst:5125 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5127 msgid "Unions of unions are flattened::" msgstr "" -#: ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5131 msgid "Redundant types are removed::" msgstr "" -#: ../../library/stdtypes.rst:5132 +#: ../../library/stdtypes.rst:5135 msgid "When comparing unions, the order is ignored::" msgstr "" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5139 msgid "It is compatible with :data:`typing.Union`::" msgstr "" -#: ../../library/stdtypes.rst:5140 +#: ../../library/stdtypes.rst:5143 msgid "Optional types can be spelled as a union with ``None``::" msgstr "" -#: ../../library/stdtypes.rst:5147 +#: ../../library/stdtypes.rst:5150 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5156 msgid "" -"However, union objects containing :ref:`parameterized generics ` cannot be used::" +"However, :ref:`parameterized generics ` in union objects " +"cannot be checked::" msgstr "" -#: ../../library/stdtypes.rst:5161 +#: ../../library/stdtypes.rst:5166 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::" msgstr "" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5179 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 override " "it::" msgstr "" -#: ../../library/stdtypes.rst:5192 +#: ../../library/stdtypes.rst:5197 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr "" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5205 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5207 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5209 +#: ../../library/stdtypes.rst:5214 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5211 +#: ../../library/stdtypes.rst:5216 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 " @@ -5604,7 +5605,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5218 +#: ../../library/stdtypes.rst:5223 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -5615,32 +5616,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5231 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5234 +#: ../../library/stdtypes.rst:5239 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5236 +#: ../../library/stdtypes.rst:5241 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5247 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5244 +#: ../../library/stdtypes.rst:5249 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:5247 +#: ../../library/stdtypes.rst:5252 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -5648,15 +5649,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5251 +#: ../../library/stdtypes.rst:5256 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`\\ 。" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5262 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5261 +#: ../../library/stdtypes.rst:5266 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: built-in methods (such as :meth:`append` on lists) and " @@ -5664,7 +5665,7 @@ msgid "" "support them." msgstr "" -#: ../../library/stdtypes.rst:5266 +#: ../../library/stdtypes.rst:5271 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 :dfn:" @@ -5676,7 +5677,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5275 +#: ../../library/stdtypes.rst:5280 msgid "" "Like function objects, bound method objects support getting arbitrary " "attributes. However, since method attributes are actually stored on the " @@ -5686,15 +5687,15 @@ msgid "" "attribute, you need to explicitly set it on the underlying function object::" msgstr "" -#: ../../library/stdtypes.rst:5295 ../../library/stdtypes.rst:5326 +#: ../../library/stdtypes.rst:5300 ../../library/stdtypes.rst:5331 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`\\ 。" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5308 msgid "Code Objects" msgstr "" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5314 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -5704,7 +5705,7 @@ msgid "" "`__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5321 msgid "" "Accessing ``__code__`` raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"__code__\"``." @@ -5712,17 +5713,17 @@ msgstr "" "存取 ``__code__`` 會引發一個附帶引數 ``obj`` 與 ``\"__code__\"`` 的\\ :ref:`" "稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5323 +#: ../../library/stdtypes.rst:5328 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:5332 +#: ../../library/stdtypes.rst:5337 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5338 +#: ../../library/stdtypes.rst:5343 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 " @@ -5730,30 +5731,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5343 +#: ../../library/stdtypes.rst:5348 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5349 +#: ../../library/stdtypes.rst:5354 msgid "The Null Object" msgstr "" -#: ../../library/stdtypes.rst:5351 +#: ../../library/stdtypes.rst:5356 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:5355 +#: ../../library/stdtypes.rst:5360 msgid "It is written as ``None``." msgstr "" -#: ../../library/stdtypes.rst:5362 +#: ../../library/stdtypes.rst:5367 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5364 +#: ../../library/stdtypes.rst:5369 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -5761,15 +5762,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5369 +#: ../../library/stdtypes.rst:5374 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5380 msgid "The NotImplemented Object" msgstr "" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5382 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 " @@ -5777,15 +5778,15 @@ msgid "" "``type(NotImplemented)()`` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5382 +#: ../../library/stdtypes.rst:5387 msgid "It is written as ``NotImplemented``." msgstr "" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5393 msgid "Boolean Values" msgstr "" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5395 msgid "" "Boolean values are the two constant objects ``False`` and ``True``. They " "are used to represent truth values (although other values can also be " @@ -5796,81 +5797,81 @@ msgid "" "(see section :ref:`truth` above)." msgstr "" -#: ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5408 msgid "They are written as ``False`` and ``True``, respectively." msgstr "" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5414 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5411 +#: ../../library/stdtypes.rst:5416 msgid "" "See :ref:`types` for this information. It describes stack frame objects, " "traceback objects, and slice objects." msgstr "" -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5423 msgid "Special Attributes" msgstr "" -#: ../../library/stdtypes.rst:5420 +#: ../../library/stdtypes.rst:5425 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:5427 +#: ../../library/stdtypes.rst:5432 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes." msgstr "" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5438 msgid "The class to which a class instance belongs." msgstr "" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5443 msgid "The tuple of base classes of a class object." msgstr "" -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5448 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5449 +#: ../../library/stdtypes.rst:5454 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5457 +#: ../../library/stdtypes.rst:5462 msgid "" "This attribute is a tuple of classes that are considered when looking for " "base classes during method resolution." msgstr "" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5468 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:5470 +#: ../../library/stdtypes.rst:5475 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:5481 +#: ../../library/stdtypes.rst:5486 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5488 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 " @@ -5878,7 +5879,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5493 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 " @@ -5888,25 +5889,25 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5495 +#: ../../library/stdtypes.rst:5500 msgid "" "Limiting conversion size offers a practical way to avoid `CVE-2020-10735 " "`_." msgstr "" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5503 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:5502 +#: ../../library/stdtypes.rst:5507 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5524 +#: ../../library/stdtypes.rst:5529 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -5914,94 +5915,94 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5534 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5549 msgid "Affected APIs" msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5551 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5554 msgid "``int(string)`` with default base 10." msgstr "" -#: ../../library/stdtypes.rst:5550 +#: ../../library/stdtypes.rst:5555 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5556 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5557 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5558 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5561 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5563 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5559 +#: ../../library/stdtypes.rst:5564 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5565 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr "" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5566 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5567 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5568 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5571 msgid "Configuring the limit" msgstr "" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5573 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:5571 +#: ../../library/stdtypes.rst:5576 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:5574 +#: ../../library/stdtypes.rst:5579 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" msgstr "" -#: ../../library/stdtypes.rst:5576 +#: ../../library/stdtypes.rst:5581 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 " @@ -6010,38 +6011,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5587 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5585 +#: ../../library/stdtypes.rst:5590 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:5589 +#: ../../library/stdtypes.rst:5594 msgid "" "Information about the default and minimum can be found in :attr:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5591 +#: ../../library/stdtypes.rst:5596 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5598 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:5600 +#: ../../library/stdtypes.rst:5605 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 " @@ -6053,7 +6054,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5614 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 " @@ -6061,11 +6062,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5620 msgid "Recommended configuration" msgstr "" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5622 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 " @@ -6073,45 +6074,45 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.11." msgstr "" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5627 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5639 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5638 +#: ../../library/stdtypes.rst:5643 msgid "Footnotes" msgstr "註解" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5644 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5642 +#: ../../library/stdtypes.rst:5647 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5645 +#: ../../library/stdtypes.rst:5650 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5647 +#: ../../library/stdtypes.rst:5652 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:5650 +#: ../../library/stdtypes.rst:5655 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -6124,13 +6125,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:315 #: ../../library/stdtypes.rst:390 ../../library/stdtypes.rst:907 #: ../../library/stdtypes.rst:1074 ../../library/stdtypes.rst:1096 -#: ../../library/stdtypes.rst:1111 ../../library/stdtypes.rst:4369 -#: ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:1111 ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:5339 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1111 -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4370 msgid "statement" msgstr "statement(陳述式)" @@ -6151,7 +6152,7 @@ msgid "value" msgstr "value" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:80 -#: ../../library/stdtypes.rst:207 ../../library/stdtypes.rst:5398 +#: ../../library/stdtypes.rst:207 ../../library/stdtypes.rst:5403 msgid "Boolean" msgstr "Boolean(布林)" @@ -6191,11 +6192,11 @@ msgstr "or" msgid "and" msgstr "and" -#: ../../library/stdtypes.rst:63 ../../library/stdtypes.rst:5398 +#: ../../library/stdtypes.rst:63 ../../library/stdtypes.rst:5403 msgid "False" msgstr "False" -#: ../../library/stdtypes.rst:63 ../../library/stdtypes.rst:5398 +#: ../../library/stdtypes.rst:63 ../../library/stdtypes.rst:5403 msgid "True" msgstr "True" @@ -6253,10 +6254,10 @@ msgstr "is not" #: ../../library/stdtypes.rst:1295 ../../library/stdtypes.rst:1339 #: ../../library/stdtypes.rst:1461 ../../library/stdtypes.rst:1497 #: ../../library/stdtypes.rst:2466 ../../library/stdtypes.rst:2485 -#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:4168 -#: ../../library/stdtypes.rst:4369 ../../library/stdtypes.rst:4838 -#: ../../library/stdtypes.rst:5093 ../../library/stdtypes.rst:5259 -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:4370 ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:5096 ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5303 msgid "object" msgstr "object(物件)" @@ -6348,9 +6349,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:245 ../../library/stdtypes.rst:907 -#: ../../library/stdtypes.rst:1074 ../../library/stdtypes.rst:4369 -#: ../../library/stdtypes.rst:5305 ../../library/stdtypes.rst:5319 -#: ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:1074 ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:5310 ../../library/stdtypes.rst:5324 +#: ../../library/stdtypes.rst:5339 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -6408,7 +6409,7 @@ msgstr "**" #: ../../library/stdtypes.rst:315 ../../library/stdtypes.rst:390 #: ../../library/stdtypes.rst:907 ../../library/stdtypes.rst:1111 -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4370 msgid "operations on" msgstr "operations on(操作於)" @@ -6417,7 +6418,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:332 ../../library/stdtypes.rst:1563 -#: ../../library/stdtypes.rst:2466 ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:2466 ../../library/stdtypes.rst:5339 msgid "module" msgstr "模組" @@ -6481,7 +6482,7 @@ msgstr "~ (波浪號)" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:804 ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:804 ../../library/stdtypes.rst:4756 msgid "protocol" msgstr "protocol(協定)" @@ -6507,7 +6508,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:907 ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:907 ../../library/stdtypes.rst:4370 msgid "len" msgstr "len" @@ -6590,8 +6591,8 @@ msgstr "list(串列)" msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1111 ../../library/stdtypes.rst:4369 -#: ../../library/stdtypes.rst:5093 ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:1111 ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:5096 ../../library/stdtypes.rst:5339 msgid "type" msgstr "type(型別)" @@ -6599,7 +6600,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1111 ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:1111 ../../library/stdtypes.rst:4370 msgid "del" msgstr "del" @@ -6768,98 +6769,98 @@ msgstr "bytearray (%)" msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4168 +#: ../../library/stdtypes.rst:4169 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4370 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4370 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4452 +#: ../../library/stdtypes.rst:4453 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4756 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4756 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4756 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4826 +#: ../../library/stdtypes.rst:4829 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4826 +#: ../../library/stdtypes.rst:4829 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4838 +#: ../../library/stdtypes.rst:4841 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4838 +#: ../../library/stdtypes.rst:4841 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4838 +#: ../../library/stdtypes.rst:4841 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5096 msgid "Union" msgstr "Union(聯集)" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5096 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5264 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5303 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5303 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5305 +#: ../../library/stdtypes.rst:5310 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5305 +#: ../../library/stdtypes.rst:5310 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5319 +#: ../../library/stdtypes.rst:5324 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5319 +#: ../../library/stdtypes.rst:5324 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5358 +#: ../../library/stdtypes.rst:5363 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5358 +#: ../../library/stdtypes.rst:5363 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" -#: ../../library/stdtypes.rst:5398 +#: ../../library/stdtypes.rst:5403 msgid "values" msgstr "values" diff --git a/library/typing.po b/library/typing.po index 24d98a9ab7..33219e2836 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-27 00:19+0000\n" +"POT-Creation-Date: 2023-07-16 00:22+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-" @@ -358,28 +358,46 @@ msgid "" "Python 3.9." msgstr "" -#: ../../library/typing.rst:249 -msgid "Callable" +#: ../../library/typing.rst:250 +msgid "Annotating callable objects" msgstr "" -#: ../../library/typing.rst:251 +#: ../../library/typing.rst:252 msgid "" -"Frameworks expecting callback functions of specific signatures might be type " -"hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``." +"Functions -- or other :term:`callable` objects -- can be annotated using :" +"class:`collections.abc.Callable` or :data:`typing.Callable`. " +"``Callable[[int], str]`` signifies a function that takes a single parameter " +"of type :class:`int` and returns a :class:`str`." msgstr "" -#: ../../library/typing.rst:254 ../../library/typing.rst:2679 +#: ../../library/typing.rst:257 ../../library/typing.rst:2684 msgid "For example:" msgstr "舉例來說" -#: ../../library/typing.rst:272 +#: ../../library/typing.rst:275 +msgid "" +"The subscription syntax must always be used with exactly two values: the " +"argument list and the return type. The argument list must be a list of " +"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return " +"type must be a single type." +msgstr "" + +#: ../../library/typing.rst:280 msgid "" -"It is possible to declare the return type of a callable without specifying " -"the call signature by substituting a literal ellipsis for the list of " -"arguments in the type hint: ``Callable[..., ReturnType]``." +"If a literal ellipsis ``...`` is given as the argument list, it indicates " +"that a callable with any arbitrary parameter list would be acceptable:" msgstr "" -#: ../../library/typing.rst:276 ../../library/typing.rst:1008 +#: ../../library/typing.rst:292 +msgid "" +"``Callable`` cannot express complex signatures such as functions that take a " +"variadic number of arguments, :func:`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:" +msgstr "" + +#: ../../library/typing.rst:319 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -390,46 +408,46 @@ msgid "" "ReturnType]`` respectively." msgstr "" -#: ../../library/typing.rst:284 ../../library/typing.rst:1020 +#: ../../library/typing.rst:327 ../../library/typing.rst:3211 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:289 +#: ../../library/typing.rst:332 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provides " "examples of usage in ``Callable``." msgstr "" -#: ../../library/typing.rst:295 +#: ../../library/typing.rst:338 msgid "Generics" msgstr "" -#: ../../library/typing.rst:297 +#: ../../library/typing.rst:340 msgid "" "Since type information about objects kept in containers cannot be statically " "inferred in a generic way, many container classes in the standard library " "support subscription to denote the expected types of container elements." msgstr "" -#: ../../library/typing.rst:314 +#: ../../library/typing.rst:357 msgid "" "Generics can be parameterized by using a factory available in typing called :" "class:`TypeVar`." msgstr "" -#: ../../library/typing.rst:330 +#: ../../library/typing.rst:373 msgid "Annotating tuples" msgstr "" -#: ../../library/typing.rst:332 +#: ../../library/typing.rst:375 msgid "" "For most containers in Python, the typing system assumes that all elements " "in the container will be of the same type. For example::" msgstr "" -#: ../../library/typing.rst:347 +#: ../../library/typing.rst:390 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." @@ -437,7 +455,7 @@ msgid "" "the keys, and the second indicates the type of the values." msgstr "" -#: ../../library/typing.rst:353 +#: ../../library/typing.rst:396 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. " @@ -445,7 +463,7 @@ msgid "" "`tuple` accepts *any number* of type arguments::" msgstr "" -#: ../../library/typing.rst:369 +#: ../../library/typing.rst:412 msgid "" "To denote a tuple which could be of *any* length, and in which all elements " "are of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, " @@ -453,11 +471,11 @@ msgid "" "using ``tuple[Any, ...]``::" msgstr "" -#: ../../library/typing.rst:392 +#: ../../library/typing.rst:435 msgid "The type of class objects" msgstr "" -#: ../../library/typing.rst:394 +#: ../../library/typing.rst:437 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " "contrast, a variable annotated with ``type[C]`` (or :class:`typing.Type[C] " @@ -465,84 +483,84 @@ msgid "" "will accept the *class object* of ``C``. For example::" msgstr "" -#: ../../library/typing.rst:404 +#: ../../library/typing.rst:447 msgid "Note that ``type[C]`` is covariant::" msgstr "" -#: ../../library/typing.rst:420 +#: ../../library/typing.rst:463 msgid "" "The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" "`type variables `, and unions of any of these types. For example::" msgstr "" -#: ../../library/typing.rst:432 +#: ../../library/typing.rst:475 msgid "" "``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" "ref:`metaclass hierarchy `." msgstr "" -#: ../../library/typing.rst:438 +#: ../../library/typing.rst:481 msgid "User-defined generic types" msgstr "" -#: ../../library/typing.rst:440 +#: ../../library/typing.rst:483 msgid "A user-defined class can be defined as a generic class." msgstr "" -#: ../../library/typing.rst:466 +#: ../../library/typing.rst:509 msgid "" "``Generic[T]`` as a base class defines that the class ``LoggedVar`` takes a " "single type parameter ``T`` . This also makes ``T`` valid as a type within " "the class body." msgstr "" -#: ../../library/typing.rst:470 +#: ../../library/typing.rst:513 msgid "" "The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so " "that ``LoggedVar[T]`` is valid as a type::" msgstr "" -#: ../../library/typing.rst:479 +#: ../../library/typing.rst:522 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" -#: ../../library/typing.rst:491 +#: ../../library/typing.rst:534 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr "" -#: ../../library/typing.rst:502 +#: ../../library/typing.rst:545 msgid "You can use multiple inheritance with :class:`Generic`::" msgstr "" -#: ../../library/typing.rst:512 +#: ../../library/typing.rst:555 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "" -#: ../../library/typing.rst:522 +#: ../../library/typing.rst:565 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "" -#: ../../library/typing.rst:524 +#: ../../library/typing.rst:567 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " "but implicitly inherits from ``Iterable[Any]``:" msgstr "" -#: ../../library/typing.rst:535 +#: ../../library/typing.rst:578 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "" -#: ../../library/typing.rst:552 +#: ../../library/typing.rst:595 msgid ":class:`Generic` no longer has a custom metaclass." msgstr "" -#: ../../library/typing.rst:555 +#: ../../library/typing.rst:598 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``Generic[P]``. The behavior " @@ -552,7 +570,7 @@ msgid "" "used to substitute a :class:`ParamSpec`::" msgstr "" -#: ../../library/typing.rst:571 +#: ../../library/typing.rst:614 msgid "" "Furthermore, a generic with only one parameter specification variable will " "accept parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also " @@ -560,20 +578,20 @@ msgid "" "converted to the former, so the following are equivalent::" msgstr "" -#: ../../library/typing.rst:583 +#: ../../library/typing.rst:626 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " "intended primarily for static type checking." msgstr "" -#: ../../library/typing.rst:587 +#: ../../library/typing.rst:630 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" -#: ../../library/typing.rst:591 +#: ../../library/typing.rst:634 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -581,24 +599,24 @@ msgid "" "term:`hashable` and comparable for equality." msgstr "" -#: ../../library/typing.rst:598 +#: ../../library/typing.rst:641 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:600 +#: ../../library/typing.rst:643 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 " "compatible with every type." msgstr "" -#: ../../library/typing.rst:604 +#: ../../library/typing.rst:647 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::" msgstr "" -#: ../../library/typing.rst:622 +#: ../../library/typing.rst:665 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 " @@ -607,19 +625,19 @@ msgid "" "runtime!" msgstr "" -#: ../../library/typing.rst:628 +#: ../../library/typing.rst:671 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -#: ../../library/typing.rst:641 +#: ../../library/typing.rst:684 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." msgstr "" -#: ../../library/typing.rst:644 +#: ../../library/typing.rst:687 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, " @@ -627,7 +645,7 @@ msgid "" "subtype of every other type." msgstr "" -#: ../../library/typing.rst:649 +#: ../../library/typing.rst:692 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 " @@ -635,24 +653,24 @@ msgid "" "example::" msgstr "" -#: ../../library/typing.rst:671 +#: ../../library/typing.rst:714 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." msgstr "" -#: ../../library/typing.rst:676 +#: ../../library/typing.rst:719 msgid "Nominal vs structural subtyping" msgstr "" -#: ../../library/typing.rst:678 +#: ../../library/typing.rst:721 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 " "expected if and only if ``A`` is a subclass of ``B``." msgstr "" -#: ../../library/typing.rst:682 +#: ../../library/typing.rst:725 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -661,7 +679,7 @@ msgid "" "code. For example, this conforms to :pep:`484`::" msgstr "" -#: ../../library/typing.rst:695 +#: ../../library/typing.rst:738 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 " @@ -670,85 +688,85 @@ msgid "" "subtyping* (or static duck-typing)::" msgstr "" -#: ../../library/typing.rst:711 +#: ../../library/typing.rst:754 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " "examples below)." msgstr "" -#: ../../library/typing.rst:716 +#: ../../library/typing.rst:759 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:718 +#: ../../library/typing.rst:761 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "" -#: ../../library/typing.rst:721 +#: ../../library/typing.rst:764 msgid "Special typing primitives" msgstr "" -#: ../../library/typing.rst:724 +#: ../../library/typing.rst:767 msgid "Special types" msgstr "" -#: ../../library/typing.rst:726 +#: ../../library/typing.rst:769 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "" -#: ../../library/typing.rst:731 +#: ../../library/typing.rst:774 msgid "Special type indicating an unconstrained type." msgstr "" -#: ../../library/typing.rst:733 +#: ../../library/typing.rst:776 msgid "Every type is compatible with :data:`Any`." msgstr "" -#: ../../library/typing.rst:734 +#: ../../library/typing.rst:777 msgid ":data:`Any` is compatible with every type." msgstr "" -#: ../../library/typing.rst:736 +#: ../../library/typing.rst:779 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 " "dynamic." msgstr "" -#: ../../library/typing.rst:743 +#: ../../library/typing.rst:786 msgid "A :ref:`constrained type variable `." msgstr "" -#: ../../library/typing.rst:745 +#: ../../library/typing.rst:788 msgid "Definition::" msgstr "" -#: ../../library/typing.rst:749 +#: ../../library/typing.rst:792 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." msgstr "" -#: ../../library/typing.rst:752 ../../library/typing.rst:828 -#: ../../library/typing.rst:848 ../../library/typing.rst:894 -#: ../../library/typing.rst:1092 ../../library/typing.rst:1149 -#: ../../library/typing.rst:1357 ../../library/typing.rst:2519 +#: ../../library/typing.rst:795 ../../library/typing.rst:871 +#: ../../library/typing.rst:891 ../../library/typing.rst:937 +#: ../../library/typing.rst:1096 ../../library/typing.rst:1153 +#: ../../library/typing.rst:1361 ../../library/typing.rst:2524 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:763 +#: ../../library/typing.rst:806 msgid "Special type that includes only literal strings." msgstr "" -#: ../../library/typing.rst:765 +#: ../../library/typing.rst:808 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -756,14 +774,14 @@ msgid "" "``LiteralString``." msgstr "" -#: ../../library/typing.rst:771 +#: ../../library/typing.rst:814 msgid "Example:" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:787 +#: ../../library/typing.rst:830 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -771,33 +789,33 @@ msgid "" "attack." msgstr "" -#: ../../library/typing.rst:792 +#: ../../library/typing.rst:835 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:798 +#: ../../library/typing.rst:841 msgid "" "The `bottom type `_, a type that " "has no members." msgstr "" -#: ../../library/typing.rst:801 +#: ../../library/typing.rst:844 msgid "" "This can be used to define a function that should never be called, or a " "function that never returns::" msgstr "" -#: ../../library/typing.rst:821 +#: ../../library/typing.rst:864 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 "" -#: ../../library/typing.rst:826 +#: ../../library/typing.rst:869 msgid "Special type indicating that a function never returns." msgstr "" -#: ../../library/typing.rst:835 +#: ../../library/typing.rst:878 msgid "" "``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " @@ -805,126 +823,126 @@ msgid "" "checkers should treat the two equivalently." msgstr "" -#: ../../library/typing.rst:846 +#: ../../library/typing.rst:889 msgid "Special type to represent the current enclosed class." msgstr "" -#: ../../library/typing.rst:858 +#: ../../library/typing.rst:901 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "" -#: ../../library/typing.rst:870 +#: ../../library/typing.rst:913 msgid "In general if something currently follows the pattern of::" msgstr "" -#: ../../library/typing.rst:877 +#: ../../library/typing.rst:920 msgid "" "You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would " "have ``Foo`` as the return type and not ``SubclassOfFoo``." msgstr "" -#: ../../library/typing.rst:880 +#: ../../library/typing.rst:923 msgid "Other common use cases include:" msgstr "" -#: ../../library/typing.rst:882 +#: ../../library/typing.rst:925 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." msgstr "" -#: ../../library/typing.rst:884 +#: ../../library/typing.rst:927 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "" -#: ../../library/typing.rst:886 +#: ../../library/typing.rst:929 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:892 +#: ../../library/typing.rst:935 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "" -#: ../../library/typing.rst:900 +#: ../../library/typing.rst:943 msgid "" "``TypeAlias`` is particularly useful for annotating aliases that make use of " "forward references, as it can be hard for type checkers to distinguish these " "from normal variable assignments:" msgstr "" -#: ../../library/typing.rst:920 +#: ../../library/typing.rst:963 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:925 +#: ../../library/typing.rst:968 msgid "Special forms" msgstr "" -#: ../../library/typing.rst:927 +#: ../../library/typing.rst:970 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." msgstr "" -#: ../../library/typing.rst:932 +#: ../../library/typing.rst:975 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" -#: ../../library/typing.rst:934 +#: ../../library/typing.rst:977 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" msgstr "" -#: ../../library/typing.rst:936 +#: ../../library/typing.rst:979 msgid "The arguments must be types and there must be at least one." msgstr "" -#: ../../library/typing.rst:938 +#: ../../library/typing.rst:981 msgid "Unions of unions are flattened, e.g.::" msgstr "" -#: ../../library/typing.rst:942 +#: ../../library/typing.rst:985 msgid "Unions of a single argument vanish, e.g.::" msgstr "" -#: ../../library/typing.rst:946 +#: ../../library/typing.rst:989 msgid "Redundant arguments are skipped, e.g.::" msgstr "" -#: ../../library/typing.rst:950 +#: ../../library/typing.rst:993 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "" -#: ../../library/typing.rst:954 +#: ../../library/typing.rst:997 msgid "You cannot subclass or instantiate a ``Union``." msgstr "" -#: ../../library/typing.rst:956 +#: ../../library/typing.rst:999 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:958 +#: ../../library/typing.rst:1001 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" -#: ../../library/typing.rst:961 +#: ../../library/typing.rst:1004 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:967 +#: ../../library/typing.rst:1010 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "" -#: ../../library/typing.rst:969 +#: ../../library/typing.rst:1012 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 " @@ -932,75 +950,35 @@ msgid "" "optional. For example::" msgstr "" -#: ../../library/typing.rst:977 +#: ../../library/typing.rst:1020 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 " "example::" msgstr "" -#: ../../library/typing.rst:984 +#: ../../library/typing.rst:1027 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -#: ../../library/typing.rst:990 -msgid "Deprecated alias to :class:`collections.abc.Callable`." -msgstr "" - -#: ../../library/typing.rst:992 -msgid "" -"``Callable[[int], str]`` signifies a function that takes a single parameter " -"of type :class:`int` and returns a :class:`str`." -msgstr "" - -#: ../../library/typing.rst:995 -msgid "" -"The subscription syntax must always be used with exactly two values: the " -"argument list and the return type. The argument list must be a list of " -"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return " -"type must be a single type." -msgstr "" - -#: ../../library/typing.rst:1000 -msgid "" -"There is no syntax to indicate optional or keyword arguments; such function " -"types are rarely used as callback types. ``Callable[..., ReturnType]`` " -"(literal ellipsis) can be used to type hint a callable taking any number of " -"arguments and returning ``ReturnType``. A plain :data:`Callable` is " -"equivalent to ``Callable[..., Any]``, and in turn to :class:`collections.abc." -"Callable`." -msgstr "" - -#: ../../library/typing.rst:1016 -msgid "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." -msgstr "" - -#: ../../library/typing.rst:1025 -msgid "" -"The documentation for :class:`ParamSpec` and :class:`Concatenate` provide " -"examples of usage with ``Callable``." -msgstr "" - -#: ../../library/typing.rst:1030 +#: ../../library/typing.rst:1033 msgid "Special form for annotating higher-order functions." msgstr "" -#: ../../library/typing.rst:1032 +#: ../../library/typing.rst:1035 msgid "" -"``Concatenate`` can be used in conjunction with :data:`Callable` and :class:" -"`ParamSpec` to annotate a higher-order callable which adds, removes, or " -"transforms parameters of another callable. Usage is in the form " -"``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. ``Concatenate`` " -"is currently only valid when used as the first argument to a :data:" -"`Callable`. The last parameter to ``Concatenate`` must be a :class:" -"`ParamSpec` or ellipsis (``...``)." +"``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " +"adds, removes, or transforms parameters of another callable. Usage is in " +"the form ``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. " +"``Concatenate`` is currently only valid when used as the first argument to " +"a :ref:`Callable `. The last parameter to " +"``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -#: ../../library/typing.rst:1041 +#: ../../library/typing.rst:1044 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -1011,34 +989,38 @@ msgid "" "passed in::" msgstr "" -#: ../../library/typing.rst:1080 ../../library/typing.rst:1736 +#: ../../library/typing.rst:1083 ../../library/typing.rst:1740 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " -"``ParamSpec`` and ``Concatenate``)." +"``ParamSpec`` and ``Concatenate``)" msgstr "" -#: ../../library/typing.rst:1082 -msgid ":class:`ParamSpec` and :class:`Callable`." -msgstr ":class:`ParamSpec` 和 :class:`Callable`\\ 。" +#: ../../library/typing.rst:1085 +msgid ":class:`ParamSpec`" +msgstr ":class:`ParamSpec`" + +#: ../../library/typing.rst:1086 ../../library/typing.rst:1743 +msgid ":ref:`annotating-callables`" +msgstr "" -#: ../../library/typing.rst:1086 +#: ../../library/typing.rst:1090 msgid "Special typing form to define \"literal types\"." msgstr "" -#: ../../library/typing.rst:1088 +#: ../../library/typing.rst:1092 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 "" -#: ../../library/typing.rst:1104 +#: ../../library/typing.rst:1108 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " "restrictions. See :pep:`586` for more details about literal types." msgstr "" -#: ../../library/typing.rst:1110 +#: ../../library/typing.rst:1114 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -1046,22 +1028,22 @@ msgid "" "their parameters are not :term:`hashable`." msgstr "" -#: ../../library/typing.rst:1118 +#: ../../library/typing.rst:1122 msgid "Special type construct to mark class variables." msgstr "" -#: ../../library/typing.rst:1120 +#: ../../library/typing.rst:1124 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 " "and should not be set on instances of that class. Usage::" msgstr "" -#: ../../library/typing.rst:1128 +#: ../../library/typing.rst:1132 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr "" -#: ../../library/typing.rst:1130 +#: ../../library/typing.rst:1134 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 " @@ -1069,27 +1051,27 @@ msgid "" "example, a type checker might flag the following code as an error::" msgstr "" -#: ../../library/typing.rst:1144 +#: ../../library/typing.rst:1148 msgid "Special typing construct to indicate final names to type checkers." msgstr "" -#: ../../library/typing.rst:1146 +#: ../../library/typing.rst:1150 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." msgstr "" -#: ../../library/typing.rst:1160 ../../library/typing.rst:2535 +#: ../../library/typing.rst:1164 ../../library/typing.rst:2540 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -#: ../../library/typing.rst:1167 +#: ../../library/typing.rst:1171 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "" -#: ../../library/typing.rst:1169 +#: ../../library/typing.rst:1173 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -1097,21 +1079,21 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1176 +#: ../../library/typing.rst:1180 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "" -#: ../../library/typing.rst:1179 +#: ../../library/typing.rst:1183 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1185 +#: ../../library/typing.rst:1189 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1187 +#: ../../library/typing.rst:1191 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -1119,7 +1101,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1192 +#: ../../library/typing.rst:1196 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 " @@ -1128,7 +1110,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1198 +#: ../../library/typing.rst:1202 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -1138,7 +1120,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1205 +#: ../../library/typing.rst:1209 msgid "" "The responsibility of how to interpret the metadata lies with the the tool " "or library encountering an ``Annotated`` annotation. A tool or library " @@ -1146,108 +1128,108 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1213 +#: ../../library/typing.rst:1217 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:1226 +#: ../../library/typing.rst:1230 msgid "Details of the syntax:" msgstr "" -#: ../../library/typing.rst:1228 +#: ../../library/typing.rst:1232 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:1230 +#: ../../library/typing.rst:1234 msgid "" "Multiple metadata elements can be supplied (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:1239 +#: ../../library/typing.rst:1243 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:1243 +#: ../../library/typing.rst:1247 msgid "" "``Annotated`` must be subscripted with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:1246 +#: ../../library/typing.rst:1250 msgid "" "The order of the metadata elements is preserved and matters for equality " "checks::" msgstr "" -#: ../../library/typing.rst:1253 +#: ../../library/typing.rst:1257 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1260 +#: ../../library/typing.rst:1264 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1266 +#: ../../library/typing.rst:1270 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1279 +#: ../../library/typing.rst:1283 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1283 +#: ../../library/typing.rst:1287 msgid "This would be equivalent to::" msgstr "" "這會等價於:\n" "\n" "::" -#: ../../library/typing.rst:1287 +#: ../../library/typing.rst:1291 msgid "" "where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " "invalid: only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1290 +#: ../../library/typing.rst:1294 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:1303 +#: ../../library/typing.rst:1307 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1317 +#: ../../library/typing.rst:1321 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1318 +#: ../../library/typing.rst:1322 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1325 +#: ../../library/typing.rst:1329 msgid "Special typing construct for marking user-defined type guard functions." msgstr "" -#: ../../library/typing.rst:1327 +#: ../../library/typing.rst:1331 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." msgstr "" -#: ../../library/typing.rst:1331 +#: ../../library/typing.rst:1335 msgid "" "``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -1256,44 +1238,44 @@ msgid "" "conditional expression here is sometimes referred to as a \"type guard\"::" msgstr "" -#: ../../library/typing.rst:1346 +#: ../../library/typing.rst:1350 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." msgstr "" -#: ../../library/typing.rst:1350 +#: ../../library/typing.rst:1354 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1353 +#: ../../library/typing.rst:1357 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1354 +#: ../../library/typing.rst:1358 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1371 +#: ../../library/typing.rst:1375 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``." msgstr "" -#: ../../library/typing.rst:1375 +#: ../../library/typing.rst:1379 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``." msgstr "" -#: ../../library/typing.rst:1381 +#: ../../library/typing.rst:1385 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]`` " @@ -1302,24 +1284,24 @@ msgid "" "guards is left to the user." msgstr "" -#: ../../library/typing.rst:1387 +#: ../../library/typing.rst:1391 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1394 +#: ../../library/typing.rst:1398 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1396 +#: ../../library/typing.rst:1400 msgid "" "For example, using the unpack operator ``*`` on a :class:`type variable " "tuple ` is equivalent to using ``Unpack`` to mark the type " "variable tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1405 +#: ../../library/typing.rst:1409 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -1327,45 +1309,45 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1422 +#: ../../library/typing.rst:1426 msgid "Building generic types" msgstr "" -#: ../../library/typing.rst:1424 +#: ../../library/typing.rst:1428 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types." msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1434 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1432 +#: ../../library/typing.rst:1436 msgid "" "A generic type is typically declared by inheriting from an instantiation of " "this class with one or more type variables. For example, a generic mapping " "type might be defined as::" msgstr "" -#: ../../library/typing.rst:1441 +#: ../../library/typing.rst:1445 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1454 +#: ../../library/typing.rst:1458 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1456 ../../library/typing.rst:1551 -#: ../../library/typing.rst:1661 ../../library/typing.rst:1774 -#: ../../library/typing.rst:1845 ../../library/typing.rst:2719 +#: ../../library/typing.rst:1460 ../../library/typing.rst:1555 +#: ../../library/typing.rst:1665 ../../library/typing.rst:1779 +#: ../../library/typing.rst:1850 ../../library/typing.rst:2724 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/typing.rst:1462 +#: ../../library/typing.rst:1466 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 " @@ -1373,69 +1355,69 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1483 +#: ../../library/typing.rst:1487 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1486 +#: ../../library/typing.rst:1490 msgid "" "Type variables may be marked covariant or contravariant by passing " "``covariant=True`` or ``contravariant=True``. See :pep:`484` for more " "details. By default, type variables are invariant." msgstr "" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1494 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:1505 +#: ../../library/typing.rst:1509 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1513 +#: ../../library/typing.rst:1517 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:1524 +#: ../../library/typing.rst:1528 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1528 +#: ../../library/typing.rst:1532 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1532 +#: ../../library/typing.rst:1536 msgid "Whether the type var has been marked as covariant." msgstr "" -#: ../../library/typing.rst:1536 +#: ../../library/typing.rst:1540 msgid "Whether the type var has been marked as contravariant." msgstr "" -#: ../../library/typing.rst:1540 +#: ../../library/typing.rst:1544 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1544 +#: ../../library/typing.rst:1548 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1548 +#: ../../library/typing.rst:1552 msgid "" "Type variable tuple. A specialized form of :class:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1559 +#: ../../library/typing.rst:1563 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -1443,7 +1425,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1581 +#: ../../library/typing.rst:1585 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, " @@ -1453,36 +1435,36 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1589 +#: ../../library/typing.rst:1593 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1596 +#: ../../library/typing.rst:1600 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:1605 +#: ../../library/typing.rst:1609 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1624 +#: ../../library/typing.rst:1628 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:1631 +#: ../../library/typing.rst:1635 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1641 +#: ../../library/typing.rst:1645 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -1491,21 +1473,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1648 +#: ../../library/typing.rst:1652 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1652 +#: ../../library/typing.rst:1656 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1658 +#: ../../library/typing.rst:1662 msgid "" "Parameter specification variable. A specialized version of :class:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1665 +#: ../../library/typing.rst:1669 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1515,7 +1497,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1672 +#: ../../library/typing.rst:1676 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 " @@ -1523,27 +1505,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1696 +#: ../../library/typing.rst:1700 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:1700 +#: ../../library/typing.rst:1704 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:1702 +#: ../../library/typing.rst:1706 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:1709 +#: ../../library/typing.rst:1713 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1556,11 +1538,11 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1721 +#: ../../library/typing.rst:1725 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:1723 +#: ../../library/typing.rst:1727 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1569,17 +1551,17 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1732 +#: ../../library/typing.rst:1736 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1738 -msgid ":class:`Callable` and :class:`Concatenate`." -msgstr ":class:`Callable` 和 :class:`Concatenate`\\ 。" +#: ../../library/typing.rst:1742 +msgid ":data:`Concatenate`" +msgstr "" -#: ../../library/typing.rst:1743 +#: ../../library/typing.rst:1748 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1587,45 +1569,45 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1748 +#: ../../library/typing.rst:1753 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:1764 +#: ../../library/typing.rst:1769 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1766 +#: ../../library/typing.rst:1771 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:1772 +#: ../../library/typing.rst:1777 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1780 +#: ../../library/typing.rst:1785 msgid "This is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/typing.rst:1784 +#: ../../library/typing.rst:1789 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1793 +#: ../../library/typing.rst:1798 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1800 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 " @@ -1634,83 +1616,83 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:1801 +#: ../../library/typing.rst:1806 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:1811 +#: ../../library/typing.rst:1816 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:1817 +#: ../../library/typing.rst:1822 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:1821 +#: ../../library/typing.rst:1826 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:1824 +#: ../../library/typing.rst:1829 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:1827 +#: ../../library/typing.rst:1832 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:1831 +#: ../../library/typing.rst:1836 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:1835 +#: ../../library/typing.rst:1840 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:1840 +#: ../../library/typing.rst:1845 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:1842 +#: ../../library/typing.rst:1847 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:1852 +#: ../../library/typing.rst:1857 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:1861 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:1860 +#: ../../library/typing.rst:1865 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:1864 +#: ../../library/typing.rst:1869 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:1869 +#: ../../library/typing.rst:1874 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:1871 +#: ../../library/typing.rst:1876 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:1877 +#: ../../library/typing.rst:1882 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:1889 +#: ../../library/typing.rst:1894 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -1718,15 +1700,15 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:1894 +#: ../../library/typing.rst:1899 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:1906 +#: ../../library/typing.rst:1911 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:1908 +#: ../../library/typing.rst:1913 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 " @@ -1735,18 +1717,18 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:1928 +#: ../../library/typing.rst:1933 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 :data:`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`." +"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:1939 +#: ../../library/typing.rst:1944 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -1754,13 +1736,13 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:1950 +#: ../../library/typing.rst:1955 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:1953 +#: ../../library/typing.rst:1958 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 " @@ -1768,53 +1750,53 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:1969 +#: ../../library/typing.rst:1974 msgid "" "To allow using this feature with older versions of Python that do not " "support :pep:`526`, ``TypedDict`` supports two additional equivalent " "syntactic forms:" msgstr "" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:1978 msgid "Using a literal :class:`dict` as the second argument::" msgstr "" -#: ../../library/typing.rst:1977 +#: ../../library/typing.rst:1982 msgid "Using keyword arguments::" msgstr "" -#: ../../library/typing.rst:1984 +#: ../../library/typing.rst:1989 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:1985 +#: ../../library/typing.rst:1990 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::" msgstr "" -#: ../../library/typing.rst:1997 +#: ../../library/typing.rst:2002 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:2008 +#: ../../library/typing.rst:2013 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2011 +#: ../../library/typing.rst:2016 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2021 +#: ../../library/typing.rst:2026 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 " @@ -1822,61 +1804,61 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2026 +#: ../../library/typing.rst:2031 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2041 +#: ../../library/typing.rst:2046 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:2048 +#: ../../library/typing.rst:2053 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2056 +#: ../../library/typing.rst:2061 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2074 +#: ../../library/typing.rst:2079 msgid "A ``TypedDict`` can be generic:" msgstr "" -#: ../../library/typing.rst:2084 +#: ../../library/typing.rst:2089 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:2090 +#: ../../library/typing.rst:2095 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2112 +#: ../../library/typing.rst:2117 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2115 +#: ../../library/typing.rst:2120 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:2118 +#: ../../library/typing.rst:2123 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 " @@ -1885,133 +1867,133 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2141 +#: ../../library/typing.rst:2146 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2145 +#: ../../library/typing.rst:2150 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2154 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2153 +#: ../../library/typing.rst:2158 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2155 +#: ../../library/typing.rst:2160 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2160 +#: ../../library/typing.rst:2165 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2165 +#: ../../library/typing.rst:2170 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2169 +#: ../../library/typing.rst:2174 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2173 +#: ../../library/typing.rst:2178 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2177 +#: ../../library/typing.rst:2182 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2183 +#: ../../library/typing.rst:2188 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2187 +#: ../../library/typing.rst:2192 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2191 +#: ../../library/typing.rst:2196 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2197 +#: ../../library/typing.rst:2202 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:2203 +#: ../../library/typing.rst:2208 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2212 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2209 +#: ../../library/typing.rst:2214 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:2216 +#: ../../library/typing.rst:2221 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2218 +#: ../../library/typing.rst:2223 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:2221 +#: ../../library/typing.rst:2226 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:2228 +#: ../../library/typing.rst:2233 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:2242 +#: ../../library/typing.rst:2247 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2244 +#: ../../library/typing.rst:2249 msgid "Example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/typing.rst:2255 +#: ../../library/typing.rst:2260 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:2260 +#: ../../library/typing.rst:2265 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 " @@ -2021,59 +2003,59 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2268 +#: ../../library/typing.rst:2273 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2271 +#: ../../library/typing.rst:2276 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2279 +#: ../../library/typing.rst:2284 msgid "Reveal the inferred static type of an expression." msgstr "" -#: ../../library/typing.rst:2281 +#: ../../library/typing.rst:2286 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2287 +#: ../../library/typing.rst:2292 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2290 +#: ../../library/typing.rst:2295 msgid "" "The function returns its argument unchanged, which allows using it within an " "expression::" msgstr "" -#: ../../library/typing.rst:2295 +#: ../../library/typing.rst:2300 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing`` allows your " "code to run without runtime errors and communicates intent more clearly." msgstr "" -#: ../../library/typing.rst:2300 +#: ../../library/typing.rst:2305 msgid "" "At runtime, this function prints the runtime type of its argument to stderr " "and returns it unchanged::" msgstr "" -#: ../../library/typing.rst:2312 +#: ../../library/typing.rst:2317 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2315 +#: ../../library/typing.rst:2320 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -2082,19 +2064,19 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2322 +#: ../../library/typing.rst:2327 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2343 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2347 +#: ../../library/typing.rst:2352 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2358 +#: ../../library/typing.rst:2363 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:2489 +#: ../../library/typing.rst:2494 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -2299,32 +2281,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:2496 +#: ../../library/typing.rst:2501 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:2504 +#: ../../library/typing.rst:2509 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:2506 +#: ../../library/typing.rst:2511 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2513 +#: ../../library/typing.rst:2518 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:2515 +#: ../../library/typing.rst:2520 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:2540 +#: ../../library/typing.rst:2545 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__\", " @@ -2334,11 +2316,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:2551 +#: ../../library/typing.rst:2556 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2553 +#: ../../library/typing.rst:2558 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 " @@ -2346,48 +2328,48 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:2559 +#: ../../library/typing.rst:2564 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:2563 +#: ../../library/typing.rst:2568 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2565 +#: ../../library/typing.rst:2570 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2570 +#: ../../library/typing.rst:2575 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2572 +#: ../../library/typing.rst:2577 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:2583 +#: ../../library/typing.rst:2588 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2587 +#: ../../library/typing.rst:2592 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2591 +#: ../../library/typing.rst:2596 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2594 +#: ../../library/typing.rst:2599 msgid "" "This is often the same as ``obj.__annotations__``. In addition, forward " "references encoded as string literals are handled by evaluating them in " @@ -2396,21 +2378,21 @@ msgid "" "__mro__`` in reverse order." msgstr "" -#: ../../library/typing.rst:2600 +#: ../../library/typing.rst:2605 msgid "" "The function recursively replaces all ``Annotated[T, ...]`` with ``T``, " "unless ``include_extras`` is set to ``True`` (see :class:`Annotated` for " "more information). For example:" msgstr "" -#: ../../library/typing.rst:2617 +#: ../../library/typing.rst:2622 msgid "" ":func:`get_type_hints` does not work with imported :ref:`type aliases ` that include forward references. Enabling postponed evaluation of " "annotations (:pep:`563`) may remove the need for most forward references." msgstr "" -#: ../../library/typing.rst:2622 +#: ../../library/typing.rst:2627 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -2418,20 +2400,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:2626 +#: ../../library/typing.rst:2631 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:2633 +#: ../../library/typing.rst:2638 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:2636 +#: ../../library/typing.rst:2641 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 :" @@ -2439,17 +2421,17 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:2642 ../../library/typing.rst:2665 +#: ../../library/typing.rst:2647 ../../library/typing.rst:2670 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:2657 +#: ../../library/typing.rst:2662 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:2660 +#: ../../library/typing.rst:2665 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 " @@ -2457,40 +2439,40 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:2677 +#: ../../library/typing.rst:2682 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2698 +#: ../../library/typing.rst:2703 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:2700 +#: ../../library/typing.rst:2705 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:2705 +#: ../../library/typing.rst:2710 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:2712 +#: ../../library/typing.rst:2717 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:2716 +#: ../../library/typing.rst:2721 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:2727 +#: ../../library/typing.rst:2732 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2498,7 +2480,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2734 +#: ../../library/typing.rst:2739 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -2506,205 +2488,211 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:2745 +#: ../../library/typing.rst:2751 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2753 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 ``[]``." +"existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:2753 +#: ../../library/typing.rst:2760 msgid "" -"The redundant types are deprecated as of Python 3.9 but no deprecation " -"warnings are issued by the interpreter. It is expected that type checkers " -"will flag the deprecated types when the checked program targets Python 3.9 " -"or newer." +"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 " +"currently planned. As such, no deprecation warnings are currently issued by " +"the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:2758 +#: ../../library/typing.rst:2765 msgid "" -"The deprecated types will be removed from the :mod:`typing` module no sooner " -"than the first Python version released 5 years after the release of Python " -"3.9.0. See details in :pep:`585`—*Type Hinting Generics In Standard " -"Collections*." +"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." msgstr "" -#: ../../library/typing.rst:2765 +#: ../../library/typing.rst:2770 +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:2776 msgid "Aliases to built-in types" msgstr "" -#: ../../library/typing.rst:2769 +#: ../../library/typing.rst:2780 msgid "Deprecated alias to :class:`dict`." msgstr "" -#: ../../library/typing.rst:2771 +#: ../../library/typing.rst:2782 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Mapping` rather than to use :class:`dict` " "or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:2775 ../../library/typing.rst:3015 +#: ../../library/typing.rst:2786 ../../library/typing.rst:3026 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:2780 +#: ../../library/typing.rst:2791 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2786 +#: ../../library/typing.rst:2797 msgid "Deprecated alias to :class:`list`." msgstr "" -#: ../../library/typing.rst:2788 +#: ../../library/typing.rst:2799 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Sequence` or :class:`Iterable` rather than " "to use :class:`list` or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:2792 +#: ../../library/typing.rst:2803 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:2802 +#: ../../library/typing.rst:2813 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2819 msgid "Deprecated alias to :class:`builtins.set `." msgstr "" -#: ../../library/typing.rst:2810 +#: ../../library/typing.rst:2821 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`AbstractSet` rather than to use :class:`set` " "or :class:`!typing.Set`." msgstr "" -#: ../../library/typing.rst:2814 +#: ../../library/typing.rst:2825 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2820 +#: ../../library/typing.rst:2831 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "" -#: ../../library/typing.rst:2822 +#: ../../library/typing.rst:2833 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2829 +#: ../../library/typing.rst:2840 msgid "Deprecated alias for :class:`tuple`." msgstr "" -#: ../../library/typing.rst:2831 +#: ../../library/typing.rst:2842 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2845 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2840 +#: ../../library/typing.rst:2851 msgid "Deprecated alias to :class:`type`." msgstr "" -#: ../../library/typing.rst:2842 +#: ../../library/typing.rst:2853 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:2847 +#: ../../library/typing.rst:2858 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2854 +#: ../../library/typing.rst:2865 msgid "Aliases to types in :mod:`collections`" msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:2869 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "" -#: ../../library/typing.rst:2862 +#: ../../library/typing.rst:2873 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2879 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "" -#: ../../library/typing.rst:2872 +#: ../../library/typing.rst:2883 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2878 +#: ../../library/typing.rst:2889 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "" -#: ../../library/typing.rst:2883 +#: ../../library/typing.rst:2894 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2889 +#: ../../library/typing.rst:2900 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "" -#: ../../library/typing.rst:2894 +#: ../../library/typing.rst:2905 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2900 +#: ../../library/typing.rst:2911 msgid "Deprecated alias to :class:`collections.deque`." msgstr "" -#: ../../library/typing.rst:2905 +#: ../../library/typing.rst:2916 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2912 +#: ../../library/typing.rst:2923 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:2917 +#: ../../library/typing.rst:2928 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:2920 +#: ../../library/typing.rst:2931 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -2712,367 +2700,383 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:2928 +#: ../../library/typing.rst:2939 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:2929 +#: ../../library/typing.rst:2940 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2935 +#: ../../library/typing.rst:2946 msgid "Deprecated alias for :class:`str`." msgstr "" -#: ../../library/typing.rst:2937 +#: ../../library/typing.rst:2948 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:2941 +#: ../../library/typing.rst:2952 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:2949 +#: ../../library/typing.rst:2960 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:2959 +#: ../../library/typing.rst:2970 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:2963 +#: ../../library/typing.rst:2974 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "" -#: ../../library/typing.rst:2965 +#: ../../library/typing.rst:2976 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2971 +#: ../../library/typing.rst:2982 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:2986 msgid "" "Prefer ``typing_extensions.Buffer``, or a union like ``bytes | bytearray | " "memoryview``." msgstr "" -#: ../../library/typing.rst:2979 +#: ../../library/typing.rst:2990 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "" -#: ../../library/typing.rst:2983 +#: ../../library/typing.rst:2994 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2989 +#: ../../library/typing.rst:3000 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "" -#: ../../library/typing.rst:2991 +#: ../../library/typing.rst:3002 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:2997 +#: ../../library/typing.rst:3008 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "" -#: ../../library/typing.rst:2999 +#: ../../library/typing.rst:3010 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3005 +#: ../../library/typing.rst:3016 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "" -#: ../../library/typing.rst:3007 +#: ../../library/typing.rst:3018 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3013 +#: ../../library/typing.rst:3024 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "" -#: ../../library/typing.rst:3020 +#: ../../library/typing.rst:3031 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3026 +#: ../../library/typing.rst:3037 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "" -#: ../../library/typing.rst:3028 +#: ../../library/typing.rst:3039 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3034 +#: ../../library/typing.rst:3045 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "" -#: ../../library/typing.rst:3036 +#: ../../library/typing.rst:3047 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3043 +#: ../../library/typing.rst:3054 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "" -#: ../../library/typing.rst:3045 +#: ../../library/typing.rst:3056 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3063 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "" -#: ../../library/typing.rst:3054 +#: ../../library/typing.rst:3065 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3060 +#: ../../library/typing.rst:3071 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "" -#: ../../library/typing.rst:3062 +#: ../../library/typing.rst:3073 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3068 +#: ../../library/typing.rst:3079 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "" -#: ../../library/typing.rst:3070 +#: ../../library/typing.rst:3081 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3077 +#: ../../library/typing.rst:3088 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3081 +#: ../../library/typing.rst:3092 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "" -#: ../../library/typing.rst:3083 +#: ../../library/typing.rst:3094 msgid "" "The variance and order of type variables correspond to those of :class:" "`Generator`, for example::" msgstr "" -#: ../../library/typing.rst:3094 +#: ../../library/typing.rst:3105 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3100 +#: ../../library/typing.rst:3111 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "" -#: ../../library/typing.rst:3102 +#: ../../library/typing.rst:3113 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:3111 +#: ../../library/typing.rst:3122 msgid "" "Unlike normal generators, async generators cannot return a value, so there " "is no ``ReturnType`` type parameter. As with :class:`Generator`, the " "``SendType`` behaves contravariantly." msgstr "" -#: ../../library/typing.rst:3115 +#: ../../library/typing.rst:3126 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3134 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3133 +#: ../../library/typing.rst:3144 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3140 +#: ../../library/typing.rst:3151 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3155 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3150 +#: ../../library/typing.rst:3161 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "" -#: ../../library/typing.rst:3154 +#: ../../library/typing.rst:3165 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3160 +#: ../../library/typing.rst:3171 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "" -#: ../../library/typing.rst:3164 +#: ../../library/typing.rst:3175 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3171 +#: ../../library/typing.rst:3182 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3175 +#: ../../library/typing.rst:3186 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "" -#: ../../library/typing.rst:3177 +#: ../../library/typing.rst:3188 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3183 +#: ../../library/typing.rst:3194 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3196 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3191 +#: ../../library/typing.rst:3202 +msgid "Deprecated alias to :class:`collections.abc.Callable`." +msgstr "" + +#: ../../library/typing.rst:3204 +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:3207 +msgid "" +":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" +"pep:`585` and :ref:`types-genericalias`." +msgstr "" + +#: ../../library/typing.rst:3217 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3219 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:3202 +#: ../../library/typing.rst:3228 msgid "" "Note that unlike many other generics in the typing module, the ``SendType`` " "of :class:`Generator` behaves contravariantly, not covariantly or " "invariantly." msgstr "" -#: ../../library/typing.rst:3206 +#: ../../library/typing.rst:3232 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3214 +#: ../../library/typing.rst:3240 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3222 +#: ../../library/typing.rst:3248 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3228 +#: ../../library/typing.rst:3254 msgid "Alias to :class:`collections.abc.Hashable`." msgstr "" -#: ../../library/typing.rst:3232 +#: ../../library/typing.rst:3258 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "" -#: ../../library/typing.rst:3234 +#: ../../library/typing.rst:3260 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3240 +#: ../../library/typing.rst:3266 msgid "Alias to :class:`collections.abc.Sized`." msgstr "" -#: ../../library/typing.rst:3245 +#: ../../library/typing.rst:3271 msgid "Aliases to :mod:`contextlib` ABCs" msgstr "" -#: ../../library/typing.rst:3249 +#: ../../library/typing.rst:3275 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3280 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3261 +#: ../../library/typing.rst:3287 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3266 +#: ../../library/typing.rst:3292 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3272 +#: ../../library/typing.rst:3298 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3300 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -3080,74 +3084,81 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3307 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3308 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3309 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3310 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3281 +#: ../../library/typing.rst:3311 msgid "``typing.io`` and ``typing.re`` submodules" msgstr "" -#: ../../library/typing.rst:3281 +#: ../../library/typing.rst:3312 msgid "3.8" msgstr "3.8" -#: ../../library/typing.rst:3281 +#: ../../library/typing.rst:3313 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3281 +#: ../../library/typing.rst:3314 msgid ":issue:`38291`" msgstr ":issue:`38291`" -#: ../../library/typing.rst:3284 +#: ../../library/typing.rst:3315 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3284 ../../library/typing.rst:3287 +#: ../../library/typing.rst:3316 ../../library/typing.rst:3320 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3284 ../../library/typing.rst:3289 -msgid "Undecided" +#: ../../library/typing.rst:3317 +msgid "Undecided (see :ref:`deprecated-typing-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3284 +#: ../../library/typing.rst:3318 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3287 -msgid "``typing.ByteString``" -msgstr "``typing.Text``" +#: ../../library/typing.rst:3319 +msgid ":class:`typing.ByteString`" +msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3287 +#: ../../library/typing.rst:3321 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3287 +#: ../../library/typing.rst:3322 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3289 -msgid "``typing.Text``" -msgstr "``typing.Text``" +#: ../../library/typing.rst:3323 +msgid ":data:`typing.Text`" +msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3289 +#: ../../library/typing.rst:3324 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3289 +#: ../../library/typing.rst:3325 +msgid "Undecided" +msgstr "" + +#: ../../library/typing.rst:3326 msgid ":gh:`92332`" msgstr ":gh:`92332`" + +#~ msgid ":class:`Callable` and :class:`Concatenate`." +#~ msgstr ":class:`Callable` 和 :class:`Concatenate`\\ 。" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 7b8129d44c..df342a0b66 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-18 00:15+0000\n" +"POT-Creation-Date: 2023-07-06 00:19+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-" @@ -39,9 +39,9 @@ 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``, ``rtspu``, ``sftp``, " -"``shttp``, ``sip``, ``sips``, ``snews``, ``svn``, ``svn+ssh``, ``telnet``, " -"``wais``, ``ws``, ``wss``." +"``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 @@ -929,7 +929,8 @@ msgstr "" #: ../../library/urllib.parse.rst:761 msgid ":rfc:`1808` - Relative Uniform Resource Locators" -msgstr ":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" +msgstr "" +":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" #: ../../library/urllib.parse.rst:759 msgid "" diff --git a/reference/expressions.po b/reference/expressions.po index 48989538e9..ebb1508065 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-08 00:17+0000\n" +"POT-Creation-Date: 2023-07-03 07:57+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-" @@ -313,8 +313,8 @@ msgstr "" #: ../../reference/expressions.rst:307 msgid "" -"A dictionary display is a possibly empty series of key/datum pairs enclosed " -"in curly braces:" +"A dictionary display is a possibly empty series of dict items (key/value " +"pairs) enclosed in curly braces:" msgstr "" #: ../../reference/expressions.rst:316 @@ -323,20 +323,20 @@ msgstr "" #: ../../reference/expressions.rst:318 msgid "" -"If a comma-separated sequence of key/datum pairs is given, they are " -"evaluated from left to right to define the entries of the dictionary: each " -"key object is used as a key into the dictionary to store the corresponding " -"datum. This means that you can specify the same key multiple times in the " -"key/datum list, and the final dictionary's value for that key will be the " -"last one given." +"If a comma-separated sequence of dict items is given, they are evaluated " +"from left to right to define the entries of the dictionary: each key object " +"is used as a key into the dictionary to store the corresponding value. This " +"means that you can specify the same key multiple times in the dict item " +"list, and the final dictionary's value for that key will be the last one " +"given." msgstr "" #: ../../reference/expressions.rst:328 msgid "" "A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. Its operand " "must be a :term:`mapping`. Each mapping item is added to the new " -"dictionary. Later values replace values already set by earlier key/datum " -"pairs and earlier dictionary unpackings." +"dictionary. Later values replace values already set by earlier dict items " +"and earlier dictionary unpackings." msgstr "" #: ../../reference/expressions.rst:333 @@ -356,7 +356,7 @@ 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 datum (textually rightmost in the display) stored for a " +"detected; the last value (textually rightmost in the display) stored for a " "given key value prevails." msgstr "" @@ -2420,12 +2420,12 @@ msgid "key" msgstr "key(鍵)" #: ../../reference/expressions.rst:298 -msgid "datum" -msgstr "datum(資料元)" +msgid "value" +msgstr "value(值)" #: ../../reference/expressions.rst:298 -msgid "key/datum pair" -msgstr "key/datum pair(鍵/資料元對)" +msgid "key/value pair" +msgstr "key/value pair(鍵/值對)" #: ../../reference/expressions.rst:298 msgid "dictionary expression" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index accbe67a34..2228049d6c 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-07-03 07:57+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-" @@ -205,7 +205,7 @@ msgstr "" msgid "" "If the primary is a mapping object (such as a dictionary), the subscript " "must have a type compatible with the mapping's key type, and the mapping is " -"then asked to create a key/datum pair which maps the subscript to the " +"then asked to create a key/value pair which maps the subscript to the " "assigned object. This can either replace an existing key/value pair with " "the same key value, or insert a new key/value pair (if no key with the same " "value existed)." diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 6d80b0495e..7d28031c5c 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2023-07-18 00:46+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-" @@ -362,7 +362,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:326 +#: ../../tutorial/controlflow.rst:327 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 " @@ -378,7 +378,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:337 +#: ../../tutorial/controlflow.rst:338 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 " @@ -394,17 +394,17 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:344 +#: ../../tutorial/controlflow.rst:345 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " -"points, we could match it like this::" +"Points, with ``__match_args__`` added, we could match it like this::" msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " -"list,我們就可以像這樣來對它進行匹配:\n" +"list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:359 +#: ../../tutorial/controlflow.rst:366 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 " @@ -416,11 +416,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:369 +#: ../../tutorial/controlflow.rst:376 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:371 +#: ../../tutorial/controlflow.rst:378 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -429,7 +429,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:375 +#: ../../tutorial/controlflow.rst:382 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -441,7 +441,7 @@ msgstr "" "是 ``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外" "的其餘項。" -#: ../../tutorial/controlflow.rst:380 +#: ../../tutorial/controlflow.rst:387 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " @@ -453,14 +453,14 @@ msgstr "" "模式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支" "援的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:385 +#: ../../tutorial/controlflow.rst:392 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "" "使用關鍵字 ``as`` 可以擷取子模式 (subpattern):\n" "\n" "::" -#: ../../tutorial/controlflow.rst:389 +#: ../../tutorial/controlflow.rst:396 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -468,7 +468,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:392 +#: ../../tutorial/controlflow.rst:399 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -476,7 +476,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``\\ 、\\ ``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:395 +#: ../../tutorial/controlflow.rst:402 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -486,18 +486,18 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:414 +#: ../../tutorial/controlflow.rst:421 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:420 +#: ../../tutorial/controlflow.rst:427 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:422 +#: ../../tutorial/controlflow.rst:429 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" @@ -506,7 +506,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:442 +#: ../../tutorial/controlflow.rst:449 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -516,7 +516,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*\\ 。它之後必須連著該函式的名稱" "和置於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:447 +#: ../../tutorial/controlflow.rst:454 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:" @@ -532,7 +532,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:454 +#: ../../tutorial/controlflow.rst:461 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -553,7 +553,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:465 +#: ../../tutorial/controlflow.rst:472 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 " @@ -568,7 +568,7 @@ msgstr "" "函式呼叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號" "表。" -#: ../../tutorial/controlflow.rst:472 +#: ../../tutorial/controlflow.rst:479 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -581,7 +581,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:483 +#: ../../tutorial/controlflow.rst:490 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 " @@ -598,7 +598,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:494 +#: ../../tutorial/controlflow.rst:501 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" @@ -607,11 +607,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:510 +#: ../../tutorial/controlflow.rst:517 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:512 +#: ../../tutorial/controlflow.rst:519 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -621,7 +621,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``\\ 。一個函式執行到結束也會回傳 " "``None``\\ 。" -#: ../../tutorial/controlflow.rst:516 +#: ../../tutorial/controlflow.rst:523 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 " @@ -643,22 +643,22 @@ msgstr "" "method 定義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同" "於 ``result = result + [a]``\\ ,但更有效率。" -#: ../../tutorial/controlflow.rst:531 +#: ../../tutorial/controlflow.rst:538 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:533 +#: ../../tutorial/controlflow.rst:540 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:540 +#: ../../tutorial/controlflow.rst:547 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:542 +#: ../../tutorial/controlflow.rst:549 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 " @@ -669,22 +669,22 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:558 +#: ../../tutorial/controlflow.rst:565 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:560 +#: ../../tutorial/controlflow.rst:567 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:562 +#: ../../tutorial/controlflow.rst:569 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:564 +#: ../../tutorial/controlflow.rst:571 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -692,14 +692,14 @@ msgstr "" "給予所有引數:\\ ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes " "or no!')``" -#: ../../tutorial/controlflow.rst:567 +#: ../../tutorial/controlflow.rst:574 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:570 +#: ../../tutorial/controlflow.rst:577 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" @@ -708,11 +708,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:588 msgid "will print ``5``." msgstr "將會輸出 ``5``\\ 。" -#: ../../tutorial/controlflow.rst:583 +#: ../../tutorial/controlflow.rst:590 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, " @@ -725,24 +725,24 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:596 +#: ../../tutorial/controlflow.rst:603 msgid "This will print ::" msgstr "" "將會輸出:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:602 +#: ../../tutorial/controlflow.rst:609 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:615 +#: ../../tutorial/controlflow.rst:622 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:617 +#: ../../tutorial/controlflow.rst:624 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -753,7 +753,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:626 +#: ../../tutorial/controlflow.rst:633 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -764,14 +764,14 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:637 +#: ../../tutorial/controlflow.rst:644 msgid "but all the following calls would be invalid::" msgstr "" "但以下呼叫方式都無效:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:644 +#: ../../tutorial/controlflow.rst:651 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 " @@ -789,7 +789,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:660 +#: ../../tutorial/controlflow.rst:667 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -807,31 +807,31 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:677 +#: ../../tutorial/controlflow.rst:684 msgid "It could be called like this::" msgstr "" "它可以被如此呼叫:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:685 +#: ../../tutorial/controlflow.rst:692 msgid "and of course it would print:" msgstr "" "輸出結果如下:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:698 +#: ../../tutorial/controlflow.rst:705 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:702 +#: ../../tutorial/controlflow.rst:709 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:704 +#: ../../tutorial/controlflow.rst:711 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 " @@ -843,11 +843,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:710 +#: ../../tutorial/controlflow.rst:717 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:721 +#: ../../tutorial/controlflow.rst:728 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-" @@ -858,22 +858,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:728 +#: ../../tutorial/controlflow.rst:735 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:730 +#: ../../tutorial/controlflow.rst:737 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:735 +#: ../../tutorial/controlflow.rst:742 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:737 +#: ../../tutorial/controlflow.rst:744 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 " @@ -888,17 +888,17 @@ msgstr "" "``/``\\ (斜線)之前。\\ ``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函" "式定義中沒有 ``/``\\ ,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:745 +#: ../../tutorial/controlflow.rst:752 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:749 +#: ../../tutorial/controlflow.rst:756 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:758 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -907,11 +907,11 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*\\ ,表明參數必須以關鍵字引數傳遞,必須在引數列" "表中第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``\\ 。" -#: ../../tutorial/controlflow.rst:757 +#: ../../tutorial/controlflow.rst:764 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:759 +#: ../../tutorial/controlflow.rst:766 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" @@ -920,7 +920,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:775 +#: ../../tutorial/controlflow.rst:782 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -931,7 +931,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:785 +#: ../../tutorial/controlflow.rst:792 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" @@ -940,7 +940,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:796 +#: ../../tutorial/controlflow.rst:803 msgid "" "The third function ``kwd_only_args`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" @@ -949,7 +949,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:807 +#: ../../tutorial/controlflow.rst:814 msgid "" "And the last uses all three calling conventions in the same function " "definition::" @@ -958,7 +958,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:827 +#: ../../tutorial/controlflow.rst:834 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -969,7 +969,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:832 +#: ../../tutorial/controlflow.rst:839 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::" @@ -979,7 +979,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:841 +#: ../../tutorial/controlflow.rst:848 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 " @@ -990,17 +990,17 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:856 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:854 +#: ../../tutorial/controlflow.rst:861 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:856 +#: ../../tutorial/controlflow.rst:863 msgid "" "The use case will determine which parameters to use in the function " "definition::" @@ -1009,11 +1009,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:860 +#: ../../tutorial/controlflow.rst:867 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:862 +#: ../../tutorial/controlflow.rst:869 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 " @@ -1025,7 +1025,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:867 +#: ../../tutorial/controlflow.rst:874 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 " @@ -1034,7 +1034,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:870 +#: ../../tutorial/controlflow.rst:877 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1042,11 +1042,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:876 +#: ../../tutorial/controlflow.rst:883 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:881 +#: ../../tutorial/controlflow.rst:888 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 " @@ -1059,7 +1059,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:890 +#: ../../tutorial/controlflow.rst:897 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1073,11 +1073,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:907 +#: ../../tutorial/controlflow.rst:914 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:909 +#: ../../tutorial/controlflow.rst:916 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 " @@ -1093,7 +1093,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:925 +#: ../../tutorial/controlflow.rst:932 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" @@ -1102,11 +1102,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:941 +#: ../../tutorial/controlflow.rst:948 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:943 +#: ../../tutorial/controlflow.rst:950 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``. " @@ -1123,7 +1123,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:960 +#: ../../tutorial/controlflow.rst:967 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1133,17 +1133,17 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:972 +#: ../../tutorial/controlflow.rst:979 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:979 +#: ../../tutorial/controlflow.rst:986 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:982 +#: ../../tutorial/controlflow.rst:989 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 " @@ -1155,7 +1155,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:995 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. " @@ -1165,7 +1165,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:993 +#: ../../tutorial/controlflow.rst:1000 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 " @@ -1187,18 +1187,18 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1005 +#: ../../tutorial/controlflow.rst:1012 msgid "Here is an example of a multi-line docstring::" msgstr "" "下面是多行說明字串的一個範例:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:1023 +#: ../../tutorial/controlflow.rst:1030 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1031 +#: ../../tutorial/controlflow.rst:1038 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -1207,7 +1207,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1035 +#: ../../tutorial/controlflow.rst:1042 msgid "" ":term:`Annotations ` are stored in the :attr:" "`__annotations__` attribute of the function as a dictionary and have no " @@ -1227,11 +1227,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:1057 +#: ../../tutorial/controlflow.rst:1064 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1062 +#: ../../tutorial/controlflow.rst:1069 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 " @@ -1244,7 +1244,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1068 +#: ../../tutorial/controlflow.rst:1075 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 " @@ -1254,11 +1254,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1073 +#: ../../tutorial/controlflow.rst:1080 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1075 +#: ../../tutorial/controlflow.rst:1082 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -1267,11 +1267,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1079 +#: ../../tutorial/controlflow.rst:1086 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1081 +#: ../../tutorial/controlflow.rst:1088 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -1279,21 +1279,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1084 +#: ../../tutorial/controlflow.rst:1091 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1087 +#: ../../tutorial/controlflow.rst:1094 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1089 +#: ../../tutorial/controlflow.rst:1096 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1091 +#: ../../tutorial/controlflow.rst:1098 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -1301,7 +1301,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:\\ ``a = f(1, 2) + g(3, " "4)``\\ 。" -#: ../../tutorial/controlflow.rst:1094 +#: ../../tutorial/controlflow.rst:1101 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -1313,7 +1313,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1099 +#: ../../tutorial/controlflow.rst:1106 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 " @@ -1322,7 +1322,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1103 +#: ../../tutorial/controlflow.rst:1110 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 " @@ -1331,11 +1331,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1109 +#: ../../tutorial/controlflow.rst:1116 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1110 +#: ../../tutorial/controlflow.rst:1117 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 " @@ -1353,54 +1353,54 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:437 ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:444 ../../tutorial/controlflow.rst:981 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:437 ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:444 ../../tutorial/controlflow.rst:981 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:437 ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:444 ../../tutorial/controlflow.rst:981 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:878 +#: ../../tutorial/controlflow.rst:885 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:878 ../../tutorial/controlflow.rst:922 +#: ../../tutorial/controlflow.rst:885 ../../tutorial/controlflow.rst:929 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:922 +#: ../../tutorial/controlflow.rst:929 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1026 +#: ../../tutorial/controlflow.rst:1033 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1026 +#: ../../tutorial/controlflow.rst:1033 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1026 +#: ../../tutorial/controlflow.rst:1033 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1026 +#: ../../tutorial/controlflow.rst:1033 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1026 +#: ../../tutorial/controlflow.rst:1033 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1060 +#: ../../tutorial/controlflow.rst:1067 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1060 +#: ../../tutorial/controlflow.rst:1067 msgid "style" msgstr "style(風格)" diff --git a/tutorial/errors.po b/tutorial/errors.po index d09bbd2026..819a972bf7 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-06 00:20+0000\n" +"POT-Creation-Date: 2023-07-06 16:53+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-" @@ -197,8 +197,8 @@ msgid "" msgstr "" ":keyword:`try` 陳述式可以有不只一個 *except 子句*\\ ,為不同的例外指定處理" "者,而最多只有一個處理者會被執行。處理者只處理對應的 try 子句中發生的例外,而" -"不會處理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句*" -"\\ 可以用一組括號內的 tuple 列舉多個例外,例如:\n" +"不會處理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句" +"*\\ 可以用一組括號內的 tuple 列舉多個例外,例如:\n" "\n" "::" @@ -626,9 +626,9 @@ msgid "" "that they can be raised together. It is an exception itself, so it can be " "caught like any other exception. ::" msgstr "" -"內建的 :exc:`ExceptionGroup` 會包裝一個例外實例 (exception instance) 的 " -"list(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像" -"任何其他例外一樣被捕獲。\n" +"內建的 :exc:`ExceptionGroup` 會包裝一個例外實例 (exception instance) 的 list" +"(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像任何" +"其他例外一樣被捕獲。\n" "\n" "::" @@ -659,11 +659,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:582 +#: ../../tutorial/errors.rst:584 msgid "Enriching Exceptions with Notes" msgstr "用註解使例外更詳細" -#: ../../tutorial/errors.rst:584 +#: ../../tutorial/errors.rst:586 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -681,7 +681,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/errors.rst:605 +#: ../../tutorial/errors.rst:607 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 " From 09d77bf957fb5d22fcdcceb45c7778012ffab994 Mon Sep 17 00:00:00 2001 From: cschan <45995789+cschan1828@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:46:10 +0800 Subject: [PATCH 23/26] Adds more translations of `library/io` (#483) * Adds more translations of library/io * Adds more translations of library/io * Small fixes * Small Fixes * Small Fixes --- library/io.po | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/library/io.po b/library/io.po index 44b4cd6031..a9848787b9 100644 --- a/library/io.po +++ b/library/io.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" -"PO-Revision-Date: 2023-07-17 17:38+0800\n" +"PO-Revision-Date: 2023-07-18 21:30+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -20,7 +20,7 @@ msgstr "" #: ../../library/io.rst:2 msgid ":mod:`io` --- Core tools for working with streams" -msgstr "" +msgstr ":mod:`io` — 處理資料串流的核心工具" #: ../../library/io.rst:15 msgid "**Source code:** :source:`Lib/io.py`" @@ -56,12 +56,18 @@ msgid "" "stream will raise a :exc:`TypeError`. So will giving a :class:`bytes` " "object to the ``write()`` method of a text stream." msgstr "" +"所有的資料串流都會謹慎處理你所提供的資料的型別。舉例來說,提供一個 :class:" +"`str` 物件給二進位資料串流的 ``write()`` 方法將會引發 :exc:`TypeError`。同樣" +"地,若提供一個 :class:`bytes` 物件給文字資料串流的 ``write()`` 方法,也會引發同" +"樣的錯誤。" #: ../../library/io.rst:45 msgid "" "Operations that used to raise :exc:`IOError` now raise :exc:`OSError`, " "since :exc:`IOError` is now an alias of :exc:`OSError`." msgstr "" +"原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因為 :" +"exc:`IOError` 現在是 :exc:`OSError` 的別名。" #: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1122 msgid "Text I/O" @@ -80,17 +86,23 @@ msgid "" "The easiest way to create a text stream is with :meth:`open()`, optionally " "specifying an encoding::" msgstr "" +"建立文字資料串流最簡單的方法是使用 :meth:`open()`,可選擇性地指定編碼:\n" +"\n" +"::" #: ../../library/io.rst:63 msgid "" "In-memory text streams are also available as :class:`StringIO` objects::" msgstr "" +"記憶體內的文字資料串流也可以使用 :class:`StringIO` 物件建立:\n" +"\n" +"::" #: ../../library/io.rst:67 msgid "" "The text stream API is described in detail in the documentation of :class:" "`TextIOBase`." -msgstr "" +msgstr "文字資料串流 API 的詳細說明在 :class:`TextIOBase` 文件當中。" #: ../../library/io.rst:72 ../../library/io.rst:1110 msgid "Binary I/O" @@ -110,11 +122,18 @@ msgid "" "The easiest way to create a binary stream is with :meth:`open()` with " "``'b'`` in the mode string::" msgstr "" +"建立二進位資料串流最簡單的方法是使用 :meth:`open()`,並在 mode 字串中加入 " +"``'b'``:\n" +"\n" +"::" #: ../../library/io.rst:85 msgid "" "In-memory binary streams are also available as :class:`BytesIO` objects::" msgstr "" +"記憶體內的二進位資料串流也可以透過 :class:`BytesIO` 物件來建立:\n" +"\n" +"::" #: ../../library/io.rst:89 msgid "" @@ -214,6 +233,9 @@ msgid "" "`PYTHONWARNDEFAULTENCODING` environment variable, which will emit an :exc:" "`EncodingWarning` when the default encoding is used." msgstr "" +"要找出哪些地方使用到預設的地區編碼,你可以啟用 ``-X warn_default_encoding`` " +"命令列選項,或者設定環境變數 :envvar:`PYTHONWARNDEFAULTENCODING`。當使用到預" +"設編碼時,會引發 :exc:`EncodingWarning`。" #: ../../library/io.rst:153 msgid "" @@ -226,7 +248,7 @@ msgstr "" #: ../../library/io.rst:162 msgid "High-level Module Interface" -msgstr "" +msgstr "高階模組介面" #: ../../library/io.rst:166 msgid "" @@ -237,7 +259,7 @@ msgstr "" #: ../../library/io.rst:173 msgid "This is an alias for the builtin :func:`open` function." -msgstr "" +msgstr "這是內建函式 :func:`open` 的別名。" #: ../../library/io.rst:175 msgid "" @@ -259,10 +281,12 @@ msgid "" "Opens the provided file with mode ``'rb'``. This function should be used " "when the intent is to treat the contents as executable code." msgstr "" +"以 ``'rb'`` 模式開啟提供的檔案。此函式應用於意圖將內容視為可執行的程式碼的情" +"況下。" #: ../../library/io.rst:187 msgid "``path`` should be a :class:`str` and an absolute path." -msgstr "" +msgstr "``path`` 應該要屬於 :class:`str` 類別,且是個絕對路徑。" #: ../../library/io.rst:189 msgid "" From 445d5a279f61535a3a585a05641ef741ba406194 Mon Sep 17 00:00:00 2001 From: Jay <74105438+weijay0804@users.noreply.github.com> Date: Sat, 22 Jul 2023 16:51:37 +0800 Subject: [PATCH 24/26] =?UTF-8?q?docs(howto/sockets.po):=20=E7=BF=BB?= =?UTF-8?q?=E8=AD=AF=20`IPC`=20=E8=88=87=20`Using=20a=20Socket`=20?= =?UTF-8?q?=E5=8D=80=E5=A1=8A=20(#493)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(howto/sockets.po): 翻譯 `IPC` 與 `Using a Socket` 區塊 gh-466 --- howto/sockets.po | 66 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/howto/sockets.po b/howto/sockets.po index 89b38480cc..4f17400d73 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-06-10 00:16+0000\n" -"PO-Revision-Date: 2023-07-12 02:22+0800\n" +"PO-Revision-Date: 2023-07-19 20:17+0800\n" "Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -180,7 +180,7 @@ msgid "" "should be plenty." msgstr "" "最後,``listen`` 引數告訴 socket 函式庫 (library),我們希望在佇列 (queue) 中" -"累積達 5 個(正常的最大值)連接請求後再拒絕外部連接。如果其餘的程式碼編寫" +"累積達 5 個(正常的最大值)連線請求後再拒絕外部連線。如果其餘的程式碼編寫" "正確,這應該足夠了。" #: ../../howto/sockets.rst:95 @@ -215,7 +215,7 @@ msgstr "" "現在最重要的是理解:這就是「伺服器端」socket 做的\\ *所有* \\事情。它不會發送任何" "資料、也不接收任何資料,它只會建立「伺服器端」socket。每個 ``clientsocket`` " "都是為了回應某些\\ *其他* \\ ``connect()`` 到我們綁定的主機上的「用戶端」socket。" -"一但 ``clientsocket`` 建立完成,就會繼續監聽更多的連接請求。兩個「用戶端」可" +"一但 ``clientsocket`` 建立完成,就會繼續監聽更多的連線請求。兩個「用戶端」可" "以隨意的通訊 - 它們使用的是一些動態分配的連接埠,會在通訊結束的時候被回收並重新" "利用。" @@ -231,16 +231,20 @@ msgid "" "a shortcut around a couple of layers of network code and be quite a bit " "faster." msgstr "" +"如果你需要在一台機器上的兩個行程間進行快速的行程間通訊 (IPC),你應該考慮使用" +"管道 (pipes) 或共享記憶體 (shared memory)。如果你確定要使用 AF_INET sockets," +"請將「伺服器端」socket 綁定到 ``'localhost'``。在大多數平台上,這樣將會繞過幾個" +"網路程式碼層,並且速度會更快一些。" #: ../../howto/sockets.rst:129 msgid "" "The :mod:`multiprocessing` integrates cross-platform IPC into a higher-level " "API." -msgstr "" +msgstr ":mod:`multiprocessing` 將跨平台的行程間通訊整合到更高層的 API 中。" #: ../../howto/sockets.rst:134 msgid "Using a Socket" -msgstr "" +msgstr "使用一個 Socket" #: ../../howto/sockets.rst:136 msgid "" @@ -252,6 +256,10 @@ msgid "" "in a request, or perhaps a signon. But that's a design decision - it's not a " "rule of sockets." msgstr "" +"首先需要注意,網頁瀏覽器的「用戶端」socket 和網路伺服器的「用戶端」socket 是" +"非常類似的。也就是說,這是一個「點對點 (peer to peer)」的通訊方式,或者也可以說\\ *作為設計" +"者,你必須決定通訊的規則*。通常情況下,``connect`` 的 socket 會通過發送一個" +"請求或者信號來開始一次通訊。但這屬於設計決策,而不是 socket 的規則。" #: ../../howto/sockets.rst:143 msgid "" @@ -264,6 +272,12 @@ msgid "" "reply. Without a ``flush`` in there, you may wait forever for the reply, " "because the request may still be in your output buffer." msgstr "" +"現在有兩組可供通訊使用的動詞。你可以使用 ``send`` 和 ``recv``,或者可以將用戶" +"端 socket 轉換成類似檔案的形式,並使用 ``read`` 和 ``write``。後者是 Java 中" +"呈現 socket 的方式。我不打算在這裡討論它,只是提醒你需要在 socket 上使用 " +"``flush``。這些是緩衝的「檔案」,一個常見的錯誤是使用 ``write`` 寫入某些內" +"容,然後直接 ``read`` 回覆。如果不使用 ``flush``,你可能會一直等待這個回覆," +"因為請求可能還在你的輸出緩衝中。" #: ../../howto/sockets.rst:152 msgid "" @@ -275,6 +289,11 @@ msgid "" "you how many bytes they handled. It is *your* responsibility to call them " "again until your message has been completely dealt with." msgstr "" +"現在我們來到 sockets 的主要障礙 - ``send`` 和 ``recv`` 操作的是網路緩衝區。他" +"們不一定會處理你提供給它們的所有位元組(或者是你期望它處理的位元組),因為它" +"們主要的重點是處理網路緩衝區。一般來說,它們會在關聯的網路衝區已滿 " +"(``send``) 或已清空 (``recv``) 時回傳,然後告訴你它們處理了多少位元組。*你" +"* \\的責任是一直呼叫它們直到你所有的訊息處理完成。" #: ../../howto/sockets.rst:160 msgid "" @@ -283,6 +302,9 @@ msgid "" "data on this connection. Ever. You may be able to send data successfully; " "I'll talk more about this later." msgstr "" +"當 ``recv`` 回傳「零位元組 (0 bytes)」時,就表示另一端已經關閉(或著正在關" +"閉)連線。你再也不能從這個連線上取得任何資料了。你可能還是可以成功發送資料;" +"我稍後會對此進行更詳細的解釋。" #: ../../howto/sockets.rst:165 msgid "" @@ -290,6 +312,9 @@ msgid "" "request, then reads a reply. That's it. The socket is discarded. This means " "that a client can detect the end of the reply by receiving 0 bytes." msgstr "" +"像 HTTP 這樣的協議只使用一個 socket 進行一次傳輸,用戶端發送一個請求,然後讀" +"取一個回覆。就這樣,然後這個 socket 就會被銷毀。這表示者用戶端可以通過接收「零" +"位元組」來檢測回覆的結束。" #: ../../howto/sockets.rst:169 msgid "" @@ -304,12 +329,23 @@ msgid "" "they are* (much better), *or end by shutting down the connection*. The " "choice is entirely yours, (but some ways are righter than others)." msgstr "" +"但是如果你打算在之後的傳輸中重新利用 socket 的話,你需要明白\\ *socket 中是不" +"存在* \\ :abbr:`EOT (傳輸結束)`。重申一次:如果一個 socket 的 ``send`` 或 " +"``recv`` 處理了「零位元組」後回傳,表示連線已經斷開。如果連線\\ *沒有* \\斷" +"開,你可能會永遠處於等待 ``recv`` 的狀態,因為(就目前來說)socket *不會* " +"\\告訴你沒有更多資料可以讀取了。現在,如果你稍微思考一下,你就會意識到 " +"socket 的一個基本事實:*訊息要麼是一個固定的長度(不好的做法),要麼是可以被" +"分隔的(普通的做法),要麼是指定其長度(更好地做法),要麼通過關閉連線來結" +"束。*\\ 完全由你來決定要使用哪種方式(但有些方法比其他方法來的更好)。" #: ../../howto/sockets.rst:180 msgid "" "Assuming you don't want to end the connection, the simplest solution is a " "fixed length message::" msgstr "" +"假設你不想結束連線,最簡單的方式就是使用固定長度的訊息:\n" +"\n" +"::" #: ../../howto/sockets.rst:217 msgid "" @@ -319,6 +355,10 @@ msgid "" "gets more complex. (And in C, it's not much worse, except you can't use " "``strlen`` if the message has embedded ``\\0``\\ s.)" msgstr "" +"發送部分的程式碼幾乎可用於任何訊息的傳送方式 - 在 Python 中你發送一個字串,可" +"以用 ``len()`` 來確認他的長度(即使字串包含了 ``\\0`` 字元)。在這裡,主要是" +"接收的程式碼變得更複雜一些。(在 C 語言中,情況沒有變得更糟,只是如果訊息中包" +"含了 ``\\0`` 字元,你就不能使用 ``strlen`` 函式。)" #: ../../howto/sockets.rst:223 msgid "" @@ -330,6 +370,11 @@ msgid "" "chunk size, (4096 or 8192 is frequently a good match for network buffer " "sizes), and scanning what you've received for a delimiter." msgstr "" +"最簡單的改進方法是將訊息的第一個字元表示訊息的類型,並根據訊息的類型來決定訊" +"息的長度。現在你需要使用兩次 ``recv`` - 第一次用於接收(至少)第一個字元來得" +"知長度,第二次用於在迴圈中接收剩下的訊息。如果你決定使用分隔符號的方式,你將會" +"以某個任意的區塊大小進行接收(4096 或 8192 通常是網路緩衝區大小的良好選擇)," +"並在收到的內容中掃描分隔符號。" #: ../../howto/sockets.rst:231 msgid "" @@ -339,6 +384,9 @@ msgid "" "of a following message. You'll need to put that aside and hold onto it, " "until it's needed." msgstr "" +"需要注意的一個複雜情況是,如果你的通訊協議允許連續發送多個訊息(沒有任何回" +"應),並且你傳遞給 ``recv`` 函式一個任意的區塊大小,最後有可能讀取到下一" +"條訊息的開頭。你需要將其放在一旁並保留下來,直到需要使用的時候。" #: ../../howto/sockets.rst:237 msgid "" @@ -351,6 +399,12 @@ msgid "" "not always manage to get rid of everything in one pass. And despite having " "read this, you will eventually get bit by it!" msgstr "" +"使用長度作為訊息的前綴(例如,使用 5 個數字字元表示)會變得更複雜,因為(信不" +"信由你)你可能無法在一次 ``recv`` 中獲得所有 5 個字元。在一般使用下,可能不會" +"有這個狀況,但在高負載的網路下,除非使用兩個 ``recv`` (第一個用於確定長度," +"第二個用於取得訊息的資料部分),否則你的程式碼很快就會出現錯誤。這令人非常頭" +"痛。同樣的情況也會讓你發現 ``send`` 並不總能在一次傳輸中完全清除所有內容。儘" +"管已經閱讀了這篇文章,但最終還是無法解決!" #: ../../howto/sockets.rst:246 msgid "" @@ -358,6 +412,8 @@ msgid "" "competitive position), these enhancements are left as an exercise for the " "reader. Lets move on to cleaning up." msgstr "" +"為了節省篇幅、培養你的技能(並保持我的競爭優勢),這些改進方法留給讀者自行練" +"習。現在讓我們開始進行清理工作。" #: ../../howto/sockets.rst:252 msgid "Binary Data" From fe7f9acc5d831ad0d04ce45628e34e40077998c0 Mon Sep 17 00:00:00 2001 From: LYC <67285884+Cliying94@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:47:12 +0800 Subject: [PATCH 25/26] #443 - pathlib: Title & Intro & Basic use (15) (#459) * Working on pathlib. * fix blank --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- library/pathlib.po | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/pathlib.po b/library/pathlib.po index f2626c8473..4b345039d1 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-11 00:16+0000\n" -"PO-Revision-Date: 2023-07-11 01:08+0800\n" +"PO-Revision-Date: 2023-07-08 16:21+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.3.1\n" +"X-Generator: Poedit 3.3.2\n" #: ../../library/pathlib.rst:3 msgid ":mod:`pathlib` --- Object-oriented filesystem paths" @@ -35,6 +35,10 @@ msgid "" "operations without I/O, and :ref:`concrete paths `, which " "inherit from pure paths but also provide I/O operations." msgstr "" +"這個模組提供了涵蓋不同作業系統中語義對等的檔案路徑類別(class)。路徑類別被分" +"為\\ :ref:`純路徑 `\\ 及\\ :ref:`具體路徑 `\\ 兩種,純路徑提供" +"純粹的計算操作而不涉及輸入輸出(I/O),而具體路徑則繼承自純路徑,同時提供輸入" +"輸出操作。" #: ../../library/pathlib.rst:26 msgid "" From 1e356ff418870ee2ae86282e3e11631658d47c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mao=20Ting=20Yang=20=28=E6=AF=9B=E9=BC=8E=E8=A8=80=29?= Date: Tue, 29 Aug 2023 23:03:55 +0800 Subject: [PATCH 26/26] finish 6 lines (#454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * finish 6 lines * Apply suggestions from code review --------- Co-authored-by: 毛鼎言 Co-authored-by: Wei-Hsiang (Matt) Wang --- library/venv.po | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/venv.po b/library/venv.po index 64a8512b80..752ca5cf6e 100644 --- a/library/venv.po +++ b/library/venv.po @@ -37,6 +37,10 @@ msgid "" "environment, so only those explicitly installed in the virtual environment " "are available." msgstr "" +":mod:`!venv` 模組支援建立輕量級的「虛擬環境」,每個環境擁有獨立的 Python 套" +"件組合,安裝在各自的 :mod:`site` 路徑底下。一個虛擬環境是以某個已安裝好的 " +"Python 版本當作虛擬環境的「基底」Python,而且可以選擇是否和基底環境的套件隔" +"離,如此一來,只有明確安裝在虛擬環境中的套件才能使用" #: ../../library/venv.rst:29 msgid ""